Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 93f94fd7
authored
Mar 26, 2025
by
Hamsyah
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
pembaruan by hmzh
1 parent
6f40132e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
37 deletions
opensipkd/base/views/jabatan.py
opensipkd/base/views/kecamatan.py
opensipkd/base/views/parameter.py
opensipkd/base/views/posisi.py
opensipkd/base/views/user_dep.py
opensipkd/base/views/jabatan.py
View file @
93f94fd
...
@@ -113,7 +113,6 @@ class ViewJabatan(BaseView):
...
@@ -113,7 +113,6 @@ class ViewJabatan(BaseView):
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
path
)
path
=
os
.
path
.
dirname
(
path
)
self
.
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'jabatan.jrxml'
)
def
get_bindings
(
self
,
row
=
None
):
def
get_bindings
(
self
,
row
=
None
):
...
@@ -131,16 +130,17 @@ class ViewJabatan(BaseView):
...
@@ -131,16 +130,17 @@ class ViewJabatan(BaseView):
return
resolver
.
abspath
()
return
resolver
.
abspath
()
def
pdf_response
(
self
,
**
kwargs
):
def
pdf_response
(
self
,
**
kwargs
):
# print("PDF RESPONSE======================================")
from
opensipkd.base.tools.report
import
jasper_export
from
opensipkd.base.tools.report
import
jasper_export
logo
=
self
.
get_module_path
(
'opensipkd.base'
)
path
=
self
.
get_module_path
(
'opensipkd.base'
)
logo
=
os
.
path
.
join
(
logo
,
'static'
,
'img'
,
'logo.png'
)
logo
=
os
.
path
.
join
(
path
,
'static'
,
'img'
,
'logo.png'
)
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'jabatan.jrxml'
)
parameters
=
{
parameters
=
{
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"alamat_lengkap"
:
get_params
(
'address'
,
"Bekasi"
),
"logo"
:
logo
"logo"
:
logo
}
}
print
(
parameters
)
filename
=
jasper_export
(
report_file
,
parameters
=
parameters
)
filename
=
jasper_export
(
self
.
report_file
,
parameters
=
parameters
)
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
@staticmethod
@staticmethod
...
...
opensipkd/base/views/kecamatan.py
View file @
93f94fd
...
@@ -85,7 +85,6 @@ class Views(BaseView):
...
@@ -85,7 +85,6 @@ class Views(BaseView):
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
path
)
path
=
os
.
path
.
dirname
(
path
)
self
.
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'kecamatan.jrxml'
)
def
form_validator
(
self
,
form
,
value
):
def
form_validator
(
self
,
form
,
value
):
def
err_kode
():
def
err_kode
():
...
@@ -138,16 +137,16 @@ class Views(BaseView):
...
@@ -138,16 +137,16 @@ class Views(BaseView):
return
resolver
.
abspath
()
return
resolver
.
abspath
()
def
pdf_response
(
self
,
**
kwargs
):
def
pdf_response
(
self
,
**
kwargs
):
# print("PDF RESPONSE======================================")
from
opensipkd.base.tools.report
import
jasper_export
from
opensipkd.base.tools.report
import
jasper_export
logo
=
self
.
get_module_path
(
'opensipkd.base'
)
path
=
self
.
get_module_path
(
'opensipkd.base'
)
logo
=
os
.
path
.
join
(
logo
,
'static'
,
'img'
,
'logo.png'
)
logo
=
os
.
path
.
join
(
path
,
'static'
,
'img'
,
'logo.png'
)
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'kecamatan.jrxml'
)
parameters
=
{
parameters
=
{
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"logo"
:
logo
"logo"
:
logo
}
}
print
(
parameters
)
filename
=
jasper_export
(
report_file
,
parameters
=
parameters
)
filename
=
jasper_export
(
self
.
report_file
,
parameters
=
parameters
)
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
@staticmethod
@staticmethod
...
...
opensipkd/base/views/parameter.py
View file @
93f94fd
...
@@ -85,7 +85,6 @@ class Views(BaseView):
...
@@ -85,7 +85,6 @@ class Views(BaseView):
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
path
)
path
=
os
.
path
.
dirname
(
path
)
self
.
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'parameter.jrxml'
)
@view_config
(
route_name
=
'parameter'
,
renderer
=
'templates/table.pt'
,
@view_config
(
route_name
=
'parameter'
,
renderer
=
'templates/table.pt'
,
permission
=
'user-edit'
)
permission
=
'user-edit'
)
...
@@ -98,16 +97,17 @@ class Views(BaseView):
...
@@ -98,16 +97,17 @@ class Views(BaseView):
return
resolver
.
abspath
()
return
resolver
.
abspath
()
def
pdf_response
(
self
,
**
kwargs
):
def
pdf_response
(
self
,
**
kwargs
):
# print("PDF RESPONSE======================================")
from
opensipkd.base.tools.report
import
jasper_export
from
opensipkd.base.tools.report
import
jasper_export
logo
=
self
.
get_module_path
(
'opensipkd.base'
)
path
=
self
.
get_module_path
(
'opensipkd.base'
)
logo
=
os
.
path
.
join
(
logo
,
'static'
,
'img'
,
'logo.png'
)
logo
=
os
.
path
.
join
(
path
,
'static'
,
'img'
,
'logo.png'
)
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'parameter.jrxml'
)
parameters
=
{
parameters
=
{
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"alamat_lengkap"
:
get_params
(
'address'
,
"Bekasi"
),
"logo"
:
logo
"logo"
:
logo
}
}
print
(
parameters
)
filename
=
jasper_export
(
report_file
,
parameters
=
parameters
)
filename
=
jasper_export
(
self
.
report_file
,
parameters
=
parameters
)
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
@staticmethod
@staticmethod
...
...
opensipkd/base/views/posisi.py
View file @
93f94fd
This diff is collapsed.
Click to expand it.
opensipkd/base/views/user_dep.py
View file @
93f94fd
...
@@ -98,7 +98,6 @@ class Views(BaseView):
...
@@ -98,7 +98,6 @@ class Views(BaseView):
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
self
.
list_buttons
=
self
.
list_buttons
+
self
.
list_report
+
(
button_import
,)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
__file__
)
path
=
os
.
path
.
dirname
(
path
)
path
=
os
.
path
.
dirname
(
path
)
self
.
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'userdep1.jrxml'
)
def
list_join
(
self
,
query
,
**
kwargs
):
def
list_join
(
self
,
query
,
**
kwargs
):
return
query
.
outerjoin
(
Departemen
,
Departemen
.
id
==
self
.
table
.
departemen_id
)
\
return
query
.
outerjoin
(
Departemen
,
Departemen
.
id
==
self
.
table
.
departemen_id
)
\
...
@@ -116,14 +115,16 @@ class Views(BaseView):
...
@@ -116,14 +115,16 @@ class Views(BaseView):
def
pdf_response
(
self
,
**
kwargs
):
def
pdf_response
(
self
,
**
kwargs
):
from
opensipkd.base.tools.report
import
jasper_export
from
opensipkd.base.tools.report
import
jasper_export
logo
=
self
.
get_module_path
(
'opensipkd.base'
)
path
=
self
.
get_module_path
(
'opensipkd.base'
)
logo
=
os
.
path
.
join
(
logo
,
'static'
,
'img'
,
'logo.png'
)
logo
=
os
.
path
.
join
(
path
,
'static'
,
'img'
,
'logo.png'
)
report_file
=
os
.
path
.
join
(
path
,
'reports'
,
'userdep1.jrxml'
)
parameters
=
{
parameters
=
{
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"judul"
:
get_params
(
'company'
,
"openSIPKD"
),
"alamat_lengkap"
:
get_params
(
'address'
,
"Bekasi"
),
"logo"
:
logo
"logo"
:
logo
}
}
print
(
parameters
)
filename
=
jasper_export
(
report_file
,
parameters
=
parameters
)
filename
=
jasper_export
(
self
.
report_file
,
parameters
=
parameters
)
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
return
file_response
(
self
.
req
,
filename
=
filename
[
0
])
@staticmethod
@staticmethod
...
@@ -180,7 +181,7 @@ class Views(BaseView):
...
@@ -180,7 +181,7 @@ class Views(BaseView):
def
view_edit
(
self
):
def
view_edit
(
self
):
response
=
super
()
.
view_edit
()
response
=
super
()
.
view_edit
()
if
isinstance
(
response
,
dict
):
if
isinstance
(
response
,
dict
):
print
(
f
"Edit response: {response}"
)
#
print(f"Edit response: {response}")
if
self
.
request
.
method
==
'POST'
:
if
self
.
request
.
method
==
'POST'
:
form
=
response
.
get
(
'form'
)
form
=
response
.
get
(
'form'
)
if
form
.
validate
():
if
form
.
validate
():
...
@@ -201,14 +202,14 @@ class Views(BaseView):
...
@@ -201,14 +202,14 @@ class Views(BaseView):
return
super
(
Views
,
self
)
.
view_upload
(
exts
=
(
".csv"
,
".tsv"
))
return
super
(
Views
,
self
)
.
view_upload
(
exts
=
(
".csv"
,
".tsv"
))
def
save_request
(
self
,
values
,
row
=
None
):
def
save_request
(
self
,
values
,
row
=
None
):
print
(
f
"Values received in save_request: {values}"
)
#
print(f"Values received in save_request: {values}")
print
(
f
"Row before save: {row}"
)
#
print(f"Row before save: {row}")
# Saat edit, gunakan user_id dari row yang ada
# Saat edit, gunakan user_id dari row yang ada
user_id
=
row
.
user_id
if
row
else
values
.
get
(
"user_id"
)
user_id
=
row
.
user_id
if
row
else
values
.
get
(
"user_id"
)
if
not
user_id
:
#
if not user_id:
print
(
"No user_id found, returning None"
)
#
print("No user_id found, returning None")
return
None
#
return None
if
"departemen_id"
in
values
:
if
"departemen_id"
in
values
:
selected_departemen
=
set
(
selected_departemen
=
set
(
...
@@ -243,7 +244,7 @@ class Views(BaseView):
...
@@ -243,7 +244,7 @@ class Views(BaseView):
if
selected_list
:
if
selected_list
:
existing_row
.
departemen_id
=
dept1
existing_row
.
departemen_id
=
dept1
existing_row
.
sub_departemen
=
dept2
existing_row
.
sub_departemen
=
dept2
print
(
f
"Updated existing row: {existing_row}"
)
#
print(f"Updated existing row: {existing_row}")
row
=
existing_row
row
=
existing_row
else
:
else
:
# Buat entri baru jika belum ada
# Buat entri baru jika belum ada
...
@@ -254,19 +255,19 @@ class Views(BaseView):
...
@@ -254,19 +255,19 @@ class Views(BaseView):
sub_departemen
=
dept2
sub_departemen
=
dept2
)
)
DBSession
.
add
(
new_row
)
DBSession
.
add
(
new_row
)
print
(
f
"Created new row: {new_row}"
)
#
print(f"Created new row: {new_row}")
row
=
new_row
row
=
new_row
else
:
else
:
row
=
None
row
=
None
try
:
try
:
DBSession
.
flush
()
DBSession
.
flush
()
print
(
f
"Row after save: {row}"
)
#print(f"Row after save: {row}")raise exception
except
Exception
as
e
:
except
Exception
as
e
:
DBSession
.
rollback
()
DBSession
.
rollback
()
print
(
f
"Error during flush: {str(e)}"
)
print
(
e
)
self
.
request
.
session
.
flash
(
f
"Gagal menyimpan: {str(e)}"
,
"error"
)
self
.
request
.
session
.
flash
(
f
"Gagal menyimpan: {str(e)}"
,
"error"
)
return
Non
e
return
e
return
row
return
row
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment