Skip to content
Snippets Groups Projects
Select Git revision
  • fa4f761188f37d99f5bf12c1d0042cb9a8aaef1e
  • master default protected
  • main
  • update_github_actions
  • 144_rocky8_support
  • 195-update-pdk-to-300
  • 144-rocky8
  • add_test_github_test_workflow
  • pdk_2.4.0
  • fix_unclosed_let_block_in_defines_client_spec
  • validation_fixes
  • freeradius_3_0_21_config_updates
  • data_types
  • PrepareBuster
  • travis
  • 4.0.1
  • 4.0.0
  • 3.9.2
  • 3.9.1
  • 3.9.0
  • 3.8.2
  • 3.8.1
  • 3.8.0
  • 3.7.0
  • 3.6.0
  • 3.5.0
  • 3.4.3
  • 3.4.2
  • 3.4.1
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 2.3.1
35 results

sql.pp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test4.php 1.44 KiB
    <?php
    
    /**
     * @var $this       \Application\View\Renderer\PhpRenderer
     * @var $controller \Zend\Mvc\Controller\AbstractController
     * @var $viewName   string
     * @var $sl         \Zend\ServiceManager\ServiceLocatorInterface
     */
    
    
    /** @var \Application\Provider\Chargens\ChargensProvider $s */
    $s  = $sl->get('chargens');
    
    /** @var \Application\Service\Etape $se */
    $se = $sl->get('applicationEtape');
    
    $data = file_get_contents('/home/laurent/data.csv');
    $data = explode( "\n", $data );
    
    $sql = [];
    
    $thids = [
        'fi' => 6,
        'fa' => 7,
        'fc' => 8,
    ];
    
    foreach( $data as $d ){
        if ($d != ''){
            $d = explode( "\t", $d);
    
            $code = trim($d[0]);
            $e = [];
            $e['fi'] = (int)trim($d[9]);
            $e['fc'] = (int)trim($d[10]);
            $e['fa'] = (int)trim($d[11]);
            //var_dump($code, $fi, $fc, $fa);
    
            $etape = $se->getRepo()->findOneBy([
                'sourceCode' => $code,
                'annee' => $se->getServiceContext()->getAnnee(),
            ]);
    
            if ($etape){
                $etapeId = $etape->getId();
    
                foreach( $e as $ec => $eff ){
                    if ($eff > 0){
                        $thid = $thids[$ec];
                        $scenarioId = 1;
                        $sql[] = "OSE_CHARGENS.INIT_SCENARIO_NOEUD_EFFECTIF($etapeId,$scenarioId,$thid, $eff, TRUE );";
                    }
                }
            }else{
    //            var_dump('étape non trouvée : '.$code);
            }
        }
    }
    
    echo implode( "<br />\n", $sql );