Skip to content
Snippets Groups Projects
Select Git revision
  • aa59ea879995b72b44149f49f2b1456a96da9c2a
  • master default protected
  • ll-workflow
  • alc-scindage-donnees-pj
  • b24
  • FJ_LL_Tbl_Contrat
  • alc-docker-node
  • ll-apiplatform
  • php84
  • ll-rgpd
  • b23
  • alc-filtre-type-intervenant
  • ll-sans-mdb5
  • formules-ancienne-infra
  • ll-formules
  • alc-intervenant-dmep
  • ll-suppr-v_vol-s
  • b20
  • ll-postgresql
  • b23.0.1
  • b22
  • 24.8
  • 24.7
  • 24.6
  • 24.5
  • 24.4
  • 24.3
  • 24.2
  • 24.1
  • 24.0
  • 23.15
  • 24.0-beta19
  • 24.0-beta18
  • 24.0-beta17
  • 24.0-beta16
  • 24.0-beta15
  • 24.0-beta14
  • 24.0-beta13
  • 23.14
  • 24.0-beta12
  • 24.0-beta11
41 results

test2.php

  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test2.php 1.68 KiB
    <?php
    
    /**
     * @var $this       \Application\View\Renderer\PhpRenderer
     * @var $controller \Zend\Mvc\Controller\AbstractController
     * @var $viewName   string
     * @var $sl         \Zend\ServiceManager\ServiceLocatorInterface
     */
    
    use Application\Connecteur\LdapConnecteur;
    use Application\Constants;
    use Doctrine\ORM\EntityManager;
    use UnicaenApp\Mapper\Ldap\People;
    
    $sql = '
    SELECT 
      a.id, 
      p.supann_emp_id
    FROM 
      affectation a
      JOIN personnel p ON p.id = a.personnel_id 
    WHERE 
      a.histo_destruction IS NULL
    ';
    
    /** @var EntityManager $em */
    $em = $sl->get(Constants::BDD);
    
    /** @var People $ldap */
    $ldapMapper = $sl->get('ldap_people_mapper');
    
    /** @var LdapConnecteur $ldap */
    $ldap = $sl->get(LdapConnecteur::class);
    
    $a = $em->getConnection()->fetchAll($sql);
    
    foreach( $a as $aff ){
        $p = $ldapMapper->findOneByNoIndividu($aff['SUPANN_EMP_ID'], true);
        $aid = $aff['ID'];
        if ($p){
            $login = $p->getSupannAliasLogin();
    
            $utilisateur = $ldap->getUtilisateur($login);
    
            $uid = $utilisateur->getId();
            $usql = "UPDATE affectation SET utilisateur_id=$uid WHERE id = $aid;";
            echo $usql."<br />";
        }
    }
    
    /*
    
    select
      a.id,
      p.nom_usuel || ' ' || p.prenom personnel,
      p.supann_emp_id supp,
      r.libelle role,
      s.libelle_court structure,
      s.libelle source,
      a.source_code a_sc,
      p.source_code p_sc
    from
      affectation a
      JOIN source s ON s.id = a.source_id
      JOIN personnel p ON p.id = a.personnel_id
      JOIN role r ON r.id = a.role_id
      LEFT JOIN structure s ON s.id = a.structure_id
    where
      a.utilisateur_id is null
      and a.histo_destruction is null;
    
    update affectation set utilisateur_id = 1 where id = 1;
    delete from affectation where utilisateur_id is null;
    
    */