Commit 07b2a19f authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Option pour rendre l'importation d'ICS optionnel

parent a90ee188
Loading
Loading
Loading
Loading
+4 −0
Changes for config/autoload/global.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ return array(
        'authPersonNormalize' => false,


        // Active l'option autorisant l'importation de calendrier pour les déclarants
        'importEnable' => true,


        'export' => [
            'payments' => [
                'separator' => '$$',
+3 −0
Changes for module/Oscar/src/Oscar/Controller/TimesheetController.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1126,6 +1126,9 @@ class TimesheetController extends AbstractOscarController
        // -------------------------------------------------------------------------------------------------------------
        // Période URL
        $period = $this->params()->fromQuery('period', null);
        if( !$this->getOscarConfigurationService()->getConfiguration('importEnable') ){
            throw new OscarException("Cette option n'est activée");
        }

        if( !$period )
            return $this->getResponseBadRequest("La période est non définit");
+2 −0
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2219,6 +2219,7 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa

        $submitable = false;
        $submitableInfos = "Vous ne pouvez pas soumettre cette période pour une raison inconnue";
        $importEnable = $this->getOscarConfig()->getConfiguration('importEnable');

        $hasConflict = false;

@@ -2478,6 +2479,7 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa
            'icsUidList' => $icsUidList,
            'feries' => $this->getLockedDays($year, $month),
            'person' => (string)$person,
            'importEnable' => $importEnable,
            'person_id' => $person->getId(),
            'period' => $periodFirstDay->format('Y-m'),
            'periodMax' => $periodMax,
+4 −0
Changes for module/Oscar/src/Oscar/View/Helpers/Options.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -35,4 +35,8 @@ class Options extends AbstractHtmlElement implements ServiceLocatorAwareInterfac
        return $this->getConfiguration()->getConfiguration('oscar_num_separator');
    }

    public function importEnable(){
        return $this->getConfiguration()->getConfiguration('importEnable');
    }

}
+2 −2
Changes for module/Oscar/view/oscar/timesheet/declarant.phtml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@
                        defaultMonth: <?= $month ?>,
                        moment: moment,
                        bootbox: bootbox,
                        url: '<?= $this->url('timesheet/declarant').($usurpation?"?person=$usurpation":"?") ?>',
                        urlimport: '<?= $this->url('timesheet/import_ical'). ($usurpation?"?person=$usurpation":"?")?>'
                        url: '<?= $this->url('timesheet/declarant').($usurpation?"?person=$usurpation":"?") ?>'
                        ,urlimport: '<?= $this->options()->importEnable() ? $this->url('timesheet/import_ical'). ($usurpation?"?person=$usurpation":"?") : '' ?>'
                    }
                });
            }