View | Details | Raw Unified | Return to bug 10212
Collapse All | Expand All

(-)a/C4/Utils/DataTables/ColumnsSettings.pm (-27 / +3 lines)
Lines 67-105 sub update_columns { Link Here
67
        $c->{is_hidden}         //= 0;
67
        $c->{is_hidden}         //= 0;
68
        $c->{cannot_be_toggled} //= 0;
68
        $c->{cannot_be_toggled} //= 0;
69
69
70
        my $column = $schema->resultset('ColumnsSetting')->search(
70
        $schema->resultset('ColumnsSetting')->update_or_create(
71
            {
71
            {
72
                module     => $c->{module},
72
                module     => $c->{module},
73
                page       => $c->{page},
73
                page       => $c->{page},
74
                tablename  => $c->{tablename},
74
                tablename  => $c->{tablename},
75
                columnname => $c->{columnname},
75
                columnname => $c->{columnname},
76
                is_hidden         => $c->{is_hidden},
77
                cannot_be_toggled => $c->{cannot_be_toggled},
76
            }
78
            }
77
        );
79
        );
78
        if ( $column->count ) {
79
            $column = $column->first;
80
            $column->update(
81
                {
82
                    module            => $c->{module},
83
                    page              => $c->{page},
84
                    tablename         => $c->{tablename},
85
                    columnname        => $c->{columnname},
86
                    is_hidden         => $c->{is_hidden},
87
                    cannot_be_toggled => $c->{cannot_be_toggled},
88
                }
89
            );
90
        }
91
        else {
92
            $schema->resultset('ColumnsSetting')->create(
93
                {
94
                    module            => $c->{module},
95
                    page              => $c->{page},
96
                    tablename         => $c->{tablename},
97
                    columnname        => $c->{columnname},
98
                    is_hidden         => $c->{is_hidden},
99
                    cannot_be_toggled => $c->{cannot_be_toggled},
100
                }
101
            );
102
        }
103
    }
80
    }
104
}
81
}
105
82
106
- 

Return to bug 10212