Overview
Comment:Fix start and end date of new year
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 4d1ef0782e9737b8f44b808b991990586d224b02
User & Date: bohwaz on 2020-11-12 23:46:05
Other Links: branch diff | manifest | tags
Context
2020-11-12
23:47
Fix missing table cell check-in: 63af30defd user: bohwaz tags: dev
23:46
Fix start and end date of new year check-in: 4d1ef0782e user: bohwaz tags: dev
23:31
Fix issue when old admin password is less than 8 characters or is compromised check-in: 027e89a7ce user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Accounting/Years.php from [d694cb65c4] to [3f5f6f9675].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	}

	static public function getNewYearDates(): array
	{
		$last_year = EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE ORDER BY end_date DESC LIMIT 1;');

		if ($last_year) {
			$diff = $last_year->start_date->diff($last_year->end_date);

			$start_date = clone $last_year->end_date;
			$start_date->modify('+1 day');

			$end_date = clone $start_date;
			$end_date->add($diff);
		}
		else {
			$start_date = new \DateTime;
			$end_date = clone $start_date;
			$end_date->modify('+1 year');
		}

		return [$start_date, $end_date];
	}
}







<
<
|
|

|
|










45
46
47
48
49
50
51


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	}

	static public function getNewYearDates(): array
	{
		$last_year = EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE ORDER BY end_date DESC LIMIT 1;');

		if ($last_year) {


			$start_date = clone $last_year->start_date;
			$start_date->modify('+1 year');

			$end_date = clone $last_year->end_date;
			$end_date->modify('+1 year');
		}
		else {
			$start_date = new \DateTime;
			$end_date = clone $start_date;
			$end_date->modify('+1 year');
		}

		return [$start_date, $end_date];
	}
}