Esempio n. 1
0
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// set headline of the script
if ($getInfId > 0) {
    $headline = $gL10n->get('ORG_EDIT_PROFILE_FIELD');
} else {
    $headline = $gL10n->get('ORG_CREATE_PROFILE_FIELD');
}
$gNavigation->addUrl(CURRENT_URL, $headline);
// benutzerdefiniertes Feldobjekt anlegen
$itemField = new TableInventoryField($gDb);
if ($getInfId > 0) {
    $itemField->readDataById($getInfId);
    // hidden must be 0, if the flag should be set
    if ($itemField->getValue('inf_hidden') == 1) {
        $itemField->setValue('inf_hidden', 0);
    } else {
        $itemField->setValue('inf_hidden', 1);
    }
    // Pruefung, ob das Feld zur aktuellen Organisation gehoert
    if ($itemField->getValue('cat_org_id') > 0 && $itemField->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id')) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
} else {
    // default values for a new field
    $itemField->setValue('inf_hidden', 1);
}
if (isset($_SESSION['fields_request'])) {
    // hidden must be 0, if the flag should be set
    if ($_SESSION['fields_request']['inf_hidden'] == 1) {
        $_SESSION['fields_request']['inf_hidden'] = 0;
Esempio n. 2
0
        $_POST['inf_hidden'] = 0;
    } else {
        $_POST['inf_hidden'] = 1;
    }
    if (!isset($_POST['inf_disabled'])) {
        $_POST['inf_disabled'] = 0;
    }
    if (!isset($_POST['inf_mandatory'])) {
        $_POST['inf_mandatory'] = 0;
    }
    // make html in description secure
    $_POST['inf_description'] = admFuncVariableIsValid($_POST, 'inf_description', 'html');
    // POST Variablen in das itemField-Objekt schreiben
    foreach ($_POST as $key => $value) {
        if (strpos($key, 'inf_') === 0) {
            $itemField->setValue($key, $value);
        }
    }
    // Daten in Datenbank schreiben
    $return_code = $itemField->save();
    if ($return_code < 0) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    $gNavigation->deleteLastUrl();
    unset($_SESSION['fields_request']);
    // zu den Organisationseinstellungen zurueck
    $gMessage->setForwardUrl($gNavigation->getUrl(), 2000);
    $gMessage->show($gL10n->get('SYS_SAVE_DATA'));
} elseif ($getMode === 2) {
    if ($itemField->getValue('inf_system') == 1) {
        // Systemfelder duerfen nicht geloescht werden