Skip to content

Commit f6afdd3

Browse files
committed
wip
1 parent 87591dc commit f6afdd3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/people_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@
568568
'allowedit' => false,
569569
'allowadd' => true,
570570
'add' => 'Register Usage',
571-
'addaction' => 'use_service',
571+
'addaction' => 'use_service&people_id='.intval($id),
572572
'allowselect' => false,
573573
'allowselectall' => false,
574574
'action' => 'people_edit',

include/use_service.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
WHERE
2929
deleted IS NULL AND camp_id = :camp_id', ['camp_id' => $_SESSION['camp']['id']]);
3030
addfield('select', 'Service', 'service_id', ['placeholder' => 'Type to search', 'required' => true, 'options' => $serviceoptions]);
31+
$people_id = $_GET['people_id'] ?? null;
3132
$beneficiaryoptions = db_array('
3233
SELECT
33-
id AS value, CONCAT(container, " ",firstname, " ", lastname) AS label
34+
id AS value, CONCAT(container, " ",firstname, " ", lastname) AS label, IF(id = :people_id, 1, 0) AS selected
3435
FROM
3536
people
3637
WHERE
37-
deleted IS NULL AND camp_id = :camp_id', ['camp_id' => $_SESSION['camp']['id']]);
38+
deleted IS NULL AND camp_id = :camp_id', ['camp_id' => $_SESSION['camp']['id'], 'people_id' => $people_id]);
3839
addfield('select', 'Beneficiaries', 'people_id', ['placeholder' => 'Type to search', 'required' => true, 'multiple' => true, 'options' => $beneficiaryoptions]);
3940

4041
$service_id = $_GET['service_id'];

0 commit comments

Comments
 (0)