From: marina Date: Mon, 26 Aug 2024 12:29:40 +0000 (+0300) Subject: Merge branch 'develop' into feature_zozirova_erp-85_1c_buh_connect X-Git-Tag: 1.4~22^2~15 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b3d28271b4ccf065ea0b995fd37c516396a9ad79;p=erp24_rep%2Fyii-erp24%2F.git Merge branch 'develop' into feature_zozirova_erp-85_1c_buh_connect # Conflicts: # erp24/composer.json # erp24/records/Motivation.php # erp24/records/MotivationBuh.php # erp24/records/MotivationBuhValue.php --- b3d28271b4ccf065ea0b995fd37c516396a9ad79 diff --cc erp24/records/Motivation.php index e2649b21,abf1c23c..e6ecadd9 --- a/erp24/records/Motivation.php +++ b/erp24/records/Motivation.php @@@ -65,25 -65,11 +65,33 @@@ class Motivation extends \yii\db\Active ]; } + public static function getWeekRangeForDate($date = null) + { + $date = $date ?? date('Y-m-d'); + + $day = date('d', $date); + $month = date('m', $date); + $year = date('m', $date); + + $weekNumber = intdiv($day - 1, 7) + 1; + + $startDay = ($weekNumber - 1) * 7 + 1; + $endDay = min($weekNumber * 7, date('t')); + + $startDate = \DateTime::createFromFormat('Y-m-d', "$year-$month-$startDay"); + $endDate = \DateTime::createFromFormat('Y-m-d', "$year-$month-$endDay"); + + return [ + 'start_time' => $startDate->format('Y-m-d'), + 'end_time' => $endDate->format('Y-m-d'), + ]; + } ++ + public static function getAdjustmentEditors() { + return array( + AdminGroup::GROUP_IT, + AdminGroup::GROUP_OPERATIONAL_DIRECTOR, + AdminGroup::DIRECTOR + ); + } }