Issues (2050)

view/js/seguridad_documentos.js (2 issues)

1
/*
2
 * Copyright (C) 2021 Joe Nilson <[email protected]>
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License as
6
 * published by the Free Software Foundation, either version 3 of the
7
 * License, or (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 * You should have received a copy of the GNU Lesser General Public License
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 */
16
17
$(document).ready(function ()
18
{
19
    var getUrlParameter = function getUrlParameter(sParam) {
20
        var sPageURL = decodeURIComponent(window.location.search.substring(1)),
21
            sURLVariables = sPageURL.split('&'),
22
            sParameterName,
23
            i;
24
25
        for (i = 0; i < sURLVariables.length; i++) {
26
            sParameterName = sURLVariables[i].split('=');
27
28
            if (sParameterName[0] === sParam) {
29
                return sParameterName[1] === undefined ? true : sParameterName[1];
30
            }
31
        }
0 ignored issues
show
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
32
    };
33
34
    //Obtenemos la información de la página
35
    var page = getUrlParameter('page');
36
    //Obtenemos el nick del usuario solicitante
37
    var usuario = $("li.user > a > span").text();
0 ignored issues
show
The variable usuario seems to be never used. Consider removing it.
Loading history...
38
39
    switch (page) {
40
        case 'ventas_factura':
41
            // $("select[name=forma_pago] option:not(:selected)").attr('disabled', true);
42
            $("input[name=fecha]").attr('readonly', true);
43
            $("input[name=hora]").attr('readonly', true);
44
            break;
45
        case 'compras_factura':
46
            // $("select[name=forma_pago] option:not(:selected)").attr('disabled', true);
47
            $("input[name=fecha]").attr('readonly', true);
48
            $("input[name=hora]").attr('readonly', true);
49
            break;
50
        default:
51
            break;
52
    }
53
});