view/js/seguridad_documentos.js   A
last analyzed

Complexity

Total Complexity 6
Complexity/F 3

Size

Lines of Code 37
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 23
c 0
b 0
f 0
dl 0
loc 37
rs 10
wmc 6
mnd 4
bc 4
fnc 2
bpm 2
cpm 3
noi 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A seguridad_documentos.js ➔ getUrlParameter 0 14 5
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
Best Practice introduced by
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
Unused Code introduced by
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
});