Explorar o código

Limit target projects to 18 months prior

Alan Lam hai 6 meses
pai
achega
86b4a64d6b
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      views/project.php

+ 5 - 1
views/project.php

@@ -14,6 +14,8 @@
  * @var float $longitude
  */
 
+use Carbon\CarbonImmutable;
+
 $time_of_day_icon = $project->getTimeOfDayIcon();
 $time_of_day_text = $project->getTimeOfDayText();
 
@@ -261,10 +263,12 @@ if($auto_select_location_id) {
 
 			<?php
 			$customer = $project->getCustomer();
+			$dt_min = CarbonImmutable::now("UTC")->subMonthsNoOverflow(18)->startOfMonth();
 
 			$target_projects = $customer->getProjects([
 				"id" => Constraint::notEquals($project->id),
-				"template_id" => $project->template_id
+				"template_id" => $project->template_id,
+				"dts_start" => Constraint::moreThanOrEquals($dt_min->toDateTimeString()),
 			]);
 			?>