Esempio n. 1
0
        $input_error = 1;
        display_error(_("The unit of measure code cannot be empty."));
        set_focus('abbr');
    }
    if (strlen(db_escape($_POST['abbr'])) > 20 + 2) {
        $input_error = 1;
        display_error(_("The unit of measure code is too long."));
        set_focus('abbr');
    }
    if (strlen($_POST['description']) == 0) {
        $input_error = 1;
        display_error(_("The unit of measure description cannot be empty."));
        set_focus('description');
    }
    if ($input_error != 1) {
        write_item_unit(htmlentities($selected_id), $_POST['abbr'], $_POST['description'], $_POST['decimals']);
        if ($selected_id != '') {
            display_notification(_('Selected unit has been updated'));
        } else {
            display_notification(_('New unit has been added'));
        }
        $Mode = 'RESET';
    }
}
//----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
    if (item_unit_used($selected_id)) {
        display_error(_("Cannot delete this unit of measure because items have been created using this unit."));
    } else {
        delete_item_unit($selected_id);
Esempio n. 2
0
        $input_error = 1;
        display_error(tr("The unit of measure code cannot be empty."));
        set_focus('abbr');
    }
    if (strlen($_POST['description']) == 0) {
        $input_error = 1;
        display_error(tr("The unit of measure description cannot be empty."));
        set_focus('description');
    }
    if (!is_numeric($_POST['decimals'])) {
        $input_error = 1;
        display_error(tr("The number of decimal places must be integer."));
        set_focus('decimals');
    }
    if ($input_error != 1) {
        write_item_unit(isset($selected_id) ? $selected_id : '', $_POST['abbr'], $_POST['description'], $_POST['decimals']);
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//----------------------------------------------------------------------------------
if (isset($_GET['delete'])) {
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
    if (item_unit_used($selected_id)) {
        display_error(tr("Cannot delete this unit of measure because items have been created using this units."));
    } else {
        delete_item_unit($selected_id);
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//----------------------------------------------------------------------------------
$result = get_all_item_units();
        $input_error = 1;
        display_error(_("The unit of measure code cannot be empty."));
        set_focus('abbr');
    }
    if (strlen(db_escape($_POST['abbr'])) > 20 + 2) {
        $input_error = 1;
        display_error(_("The unit of measure code is too long."));
        set_focus('abbr');
    }
    if (strlen($_POST['description']) == 0) {
        $input_error = 1;
        display_error(_("The unit of measure description cannot be empty."));
        set_focus('description');
    }
    if ($input_error != 1) {
        write_item_unit($selected_id, $_POST['abbr'], $_POST['description'], $_POST['decimals']);
        if ($selected_id != '') {
            display_notification(_('Selected unit has been updated'));
        } else {
            display_notification(_('New unit has been added'));
        }
        $Mode = 'RESET';
    }
}
//----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
    if (item_unit_used($selected_id)) {
        display_error(_("Cannot delete this unit of measure because items have been created using this unit."));
    } else {
        delete_item_unit($selected_id);