Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
05659454
Commit
05659454
authored
1 year ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
allow forcing of 'manual auto insert', fixes #2576
Closes #2576 Merge request
studip/studip!1735
parent
bdded9bf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/admin/autoinsert.php
+10
-6
10 additions, 6 deletions
app/controllers/admin/autoinsert.php
app/views/admin/autoinsert/manual.php
+32
-13
32 additions, 13 deletions
app/views/admin/autoinsert/manual.php
lib/classes/AutoInsert.class.php
+5
-6
5 additions, 6 deletions
lib/classes/AutoInsert.class.php
with
47 additions
and
25 deletions
app/controllers/admin/autoinsert.php
+
10
−
6
View file @
05659454
...
...
@@ -149,14 +149,17 @@ class Admin_AutoinsertController extends AuthenticatedController
$this
->
seminar_search
=
[];
PageLayout
::
setTitle
(
_
(
'Manuelles Eintragen von Nutzergruppen in Veranstaltungen'
));
if
(
Request
::
submitted
(
'submit'
))
{
if
(
Request
::
submitted
Some
(
'submit'
,
'force'
))
{
$filters
=
array_filter
(
Request
::
getArray
(
'filter'
));
if
(
!
Request
::
get
(
'sem_id'
)
||
Request
::
get
(
'sem_id'
)
==
'false'
)
{
$force
=
Request
::
bool
(
'force'
,
false
);
$seminar_id
=
Request
::
option
(
'sem_id'
);
if
(
!
$seminar_id
||
$seminar_id
===
'false'
)
{
PageLayout
::
postError
(
_
(
'Ungültiger Aufruf'
));
}
elseif
(
!
count
(
$filters
))
{
PageLayout
::
postError
(
_
(
'Keine Filterkriterien gewählt'
));
}
else
{
$seminar
=
Seminar
::
GetInstance
(
Request
::
option
(
'sem
_id
'
)
);
$seminar
=
Seminar
::
GetInstance
(
$seminar
_id
);
$userlookup
=
new
UserLookup
();
foreach
(
$filters
as
$type
=>
$values
)
{
...
...
@@ -166,9 +169,9 @@ class Admin_AutoinsertController extends AuthenticatedController
$real_users
=
0
;
foreach
(
$user_ids
as
$user_id
)
{
if
(
!
AutoInsert
::
checkAutoInsertUser
(
Request
::
option
(
'sem
_id
'
)
,
$user_id
))
{
$seminar
->
addMember
(
$user_id
);
$real_users
+=
AutoInsert
::
saveAutoInsertUser
(
Request
::
option
(
'sem
_id
'
)
,
$user_id
);
if
(
$force
||
!
AutoInsert
::
checkAutoInsertUser
(
$seminar
_id
,
$user_id
))
{
$real_users
+=
$seminar
->
addMember
(
$user_id
)
?
1
:
0
;
AutoInsert
::
saveAutoInsertUser
(
$seminar
_id
,
$user_id
);
}
}
...
...
@@ -192,6 +195,7 @@ class Admin_AutoinsertController extends AuthenticatedController
}
$this
->
redirect
(
'admin/autoinsert/manual'
);
return
;
}
}
...
...
This diff is collapsed.
Click to expand it.
app/views/admin/autoinsert/manual.php
+
32
−
13
View file @
05659454
...
...
@@ -134,6 +134,25 @@
</tr>
</tbody>
<?
endif
?>
<thead>
<tr>
<th
colspan=
"3"
>
<?=
_
(
'Einstellungen'
)
?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td
colspan=
"3"
>
<label>
<input
type=
"checkbox"
name=
"force"
value=
"1"
>
<?=
_
(
'Eintragung forcieren'
)
?>
<?=
tooltipIcon
(
implode
(
"
\n
"
,
[
_
(
'Über diese Einstellung kann forciert werden, dass alle gefundenen Personen in die Veranstaltung eingetragen werden.'
),
_
(
'Ansonsten werden nur die Personen eingetragen, die bislang noch nicht über diesen Mechanismus eingetragen wurden.'
),
]))
?>
</label>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td
colspan=
"3"
>
...
...
@@ -157,20 +176,20 @@
if
(
!
$
(
this
).
next
().
length
||
!
$
(
this
).
next
().
is
(
'
span
'
))
{
$
(
this
).
after
(
$
(
'
<span id="autoinsert_count" style="vertical-align: middle;"/>
'
));
}
$
.
getJSON
(
'
<?=
$controller
->
manual_count
()
?>
'
,
$
(
this
).
closest
(
'
form
'
).
serializeArray
(),
function
(
json
)
{
var
result
=
""
;
if
(
!
json
||
json
.
error
)
{
result
=
'
<?=
_
(
'Fehler'
)
?>
:
'
;
result
+=
json
.
error
||
'
<?=
_
(
'Fehler bei der Übertragung'
)
?>
'
;
}
else
{
result
=
'
<?=
_
(
'Gefundene Nutzer'
)
?>
:
'
;
result
+=
"
<strong>
"
+
json
.
users
+
"
</strong>
"
;
}
$
(
'
#autoinsert_count
'
).
html
(
result
);
$
.
getJSON
(
'
<?=
$controller
->
manual_count
()
?>
'
,
$
(
this
).
closest
(
'
form
'
).
serializeArray
()
).
done
(
function
(
json
)
{
let
result
=
''
;
if
(
!
json
||
json
.
error
)
{
result
=
'
<?=
_
(
'Fehler'
)
?>
:
'
;
result
+=
json
.
error
||
'
<?=
_
(
'Fehler bei der Übertragung'
)
?>
'
;
}
else
{
result
=
'
<?=
_
(
'Gefundene Personen'
)
?>
:
'
;
result
+=
"
<strong>
"
+
json
.
users
+
"
</strong>
"
;
}
);
$
(
'
#autoinsert_count
'
).
html
(
'
'
+
result
);
});
event
.
preventDefault
();
});
$
(
'
input[name^=remove_filter]
'
).
click
(
function
(
event
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/classes/AutoInsert.class.php
+
5
−
6
View file @
05659454
...
...
@@ -313,12 +313,11 @@ class AutoInsert
*/
public
static
function
saveAutoInsertUser
(
$seminar_id
,
$user_id
)
{
$query
=
"INSERT INTO auto_insert_user (Seminar_id, user_id, mkdate)
SELECT ?, user_id, UNIX_TIMESTAMP() FROM auth_user_md5 WHERE
user_id=? AND perms NOT IN('root','admin')"
;
$statement
=
DBManager
::
get
()
->
prepare
(
$query
);
$statement
->
execute
([
$seminar_id
,
$user_id
]);
return
$statement
->
rowCount
();
$query
=
"INSERT IGNORE INTO auto_insert_user (Seminar_id, user_id, mkdate)
SELECT ?, user_id, UNIX_TIMESTAMP()
FROM auth_user_md5
WHERE user_id = ? AND perms NOT IN ('root','admin')"
;
return
DBManager
::
get
()
->
execute
(
$query
,
[
$seminar_id
,
$user_id
]);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment