Browse Source

Limit target projects to 18 months prior

Alan Lam 6 months ago
parent
commit
86b4a64d6b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      views/project.php

+ 5 - 1
views/project.php

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