]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7484 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 23 Apr 2025 14:58:31 +0000 (16:58 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 23 Apr 2025 14:58:31 +0000 (16:58 +0200)
app/Models/TeamLeave.php
app/Models/TeamOvertime.php

index 4c40342da742b66a2949fc4eea7a39265a10e6f0..edef3bc2464258331b76903b0df29da4ae30b564 100644 (file)
@@ -62,7 +62,7 @@ class TeamLeave extends ToolboxHRModel
         $this->addField('recorded_month', Date::class, __('Comptabilisé'), ['column' => true, 'column_format' => 'YYYY-MM', 'can' => self::$_permissionBase . ':admin']);
         $this->addField('comment', Text::class, __('Commentaire'), ['column' => true, 'can' => self::$_permissionBase . ':admin']);
 
-        if (can(''))
+        if (can(self::$_permissionBase . ':admin')) {
             $this->addFilter('compta', 'simple', 'À comptabiliser', function ($value, $crud) {
                 $startOfNextMonth = Carbon::now();
                 $startOfNextMonth->day = 1;
@@ -72,6 +72,7 @@ class TeamLeave extends ToolboxHRModel
                 $crud->addClause('where', 'worker', '>=', 4);
                 $crud->addClause('where', 'start_day', '<=', $startOfNextMonth);
             });
+        }
     }
 
 
index 3df148af896dd458530ddc1287c2e416f59bc1d3..b9042c832d56c3688fc938ae5a0f80a1a1e8f9c5 100644 (file)
@@ -8,6 +8,7 @@ use Cubist\Backpack\Magic\Fields\Date;
 use Cubist\Backpack\Magic\Fields\Number;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\Text;
+
 // __('!! Équipe')
 class TeamOvertime extends ToolboxHRModel
 {
@@ -46,5 +47,11 @@ class TeamOvertime extends ToolboxHRModel
         $this->addField('accepted', Checkbox::class, __('Accepté'), ['column' => true, 'default' => true, 'can' => self::$_permissionBase . ':admin']);
         $this->addField('recorded_month', Date::class, __('Comptabilisé'), ['column' => true, 'column_format' => 'YYYY-MM', 'can' => self::$_permissionBase . ':admin']);
         $this->addField('comment', Text::class, __('Commentaire'), ['column' => true, 'can' => self::$_permissionBase . ':admin']);
+
+        if (can(self::$_permissionBase . ':admin')) {
+            $this->addFilter('compta', 'simple', 'À comptabiliser', function ($value, $crud) {
+                $crud->addClause('whereNull', 'recorded_month');
+            });
+        }
     }
 }