Ejemplo n.º 1
0
function plugin_addressing_MassiveActionsProcess($data)
{
    $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
    switch ($data['action']) {
        case 'plugin_addressing_allow':
            if ($data['itemtype'] == 'Profile') {
                $profglpi = new Profile();
                $prof = new PluginAddressingProfile();
                foreach ($data["item"] as $key => $val) {
                    if ($profglpi->getFromDB($key) && $profglpi->fields['interface'] != 'helpdesk') {
                        if ($prof->getFromDBByProfile($key)) {
                            if ($prof->update(array('id' => $prof->fields['id'], 'profiles_id' => $key, 'addressing' => $data['use']))) {
                                $res['ok']++;
                            } else {
                                $res['ko']++;
                            }
                        } else {
                            if ($prof->add(array('id' => $prof->fields['id'], 'profiles_id' => $key, 'addressing' => $data['use']))) {
                                $res['ok']++;
                            } else {
                                $res['ko']++;
                            }
                        }
                    } else {
                        $res['ko']++;
                    }
                }
            }
            break;
    }
    return $res;
}
Ejemplo n.º 2
0
Copyright (C) 2003-2011 by the addressing Development Team.

https://forge.indepnet.net/projects/addressing
-------------------------------------------------------------------------

LICENSE

This file is part of addressing.

Addressing is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Addressing is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Addressing. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
Session::checkRight("profile", "r");
$prof = new PluginAddressingProfile();
//Save profile
if (isset($_POST['update'])) {
    $prof->update($_POST);
    Html::back();
}