Project

General

Profile

Revision e1c378c0

IDe1c378c02254906b8b2de7dd4fc79f49ea8a8987
Parent 0ff49d9f
Child 811c1e5a

Added by Francois POIROTTE about 7 years ago

Ajout de groupes pour les techniciens

Change-Id: If870608da01779b6b922ca57dae7aa36a5566138
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2392
Tested-by: Build system <>
Reviewed-by: Francois POIROTTE <>

View differences:

src/plugins/vigilo/inc/groups.class.php
10 10
            'Entities'      => new VigiloGroups('Entities'),
11 11
            'Manufacturers' => new VigiloGroups('Manufacturers'),
12 12
            'Locations'     => new VigiloGroups('Locations'),
13
            'Technicians'   => new VigiloGroups('Technicians'),
13 14
        );
14 15

  
15 16
        $this->getManufacturers();
16 17
        $this->getEntities();
17 18
        $this->getLocations();
19
        $this->getTechnicians();
18 20
    }
19 21

  
20 22
    public function getName()
......
63 65
        }
64 66
    }
65 67

  
68
    protected function getTechnicians()
69
    {
70
        global $DB;
71

  
72
        // Ce serait plus propre d'utiliser la surcouche de GLPI
73
        // pour récupérer l'information, mais cela serait aussi
74
        // beaucoup plus coûteux (plus d'appels à la BDD, etc.).
75

  
76
        $query = <<<SQL
77
SELECT DISTINCT u.name
78
FROM glpi_users u
79
JOIN (
80
    SELECT users_id_tech
81
    FROM glpi_computers
82
    UNION ALL
83
    SELECT users_id_tech
84
    FROM glpi_networkequipments
85
    UNION ALL
86
    SELECT users_id_tech
87
    FROM glpi_printers
88
) as a1 on a1.users_id_tech = u.id;
89
SQL;
90
        foreach ($DB->request($query) as $row) {
91
            $this->groups['Technicians'][] = $row['name'];
92
        }
93
    }
94

  
66 95
    public function __toString()
67 96
    {
68 97
        $out  = "<groups>\n";

Also available in: Unified diff