-
Notifications
You must be signed in to change notification settings - Fork 153
Allow multiple petty cash assigners and authorizers #914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cb17f44
27029d3
dbff8b4
8f61d94
cd3dfea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,9 +62,9 @@ | |||||||||||||
| AND pcashdetails.codeexpense='".$SelectedExpense."' | ||||||||||||||
| AND pcashdetails.date >='" . $SQL_FromDate . "' | ||||||||||||||
| AND pcashdetails.date <= '" . $SQL_ToDate . "' | ||||||||||||||
| AND (pctabs.authorizer='" . $_SESSION['UserID'] . | ||||||||||||||
| "' OR pctabs.usercode ='" . $_SESSION['UserID']. | ||||||||||||||
| "' OR pctabs.assigner ='" . $_SESSION['UserID'] . "') | ||||||||||||||
| AND (pctabs.authorizer LIKE '%" . $_SESSION['UserID'] . "%' | ||||||||||||||
| OR pctabs.usercode = '" . $_SESSION['UserID'] . "' | ||||||||||||||
| OR pctabs.assigner LIKE '%" . $_SESSION['UserID'] . "%' ) | ||||||||||||||
|
Comment on lines
+65
to
+67
|
||||||||||||||
| AND (pctabs.authorizer LIKE '%" . $_SESSION['UserID'] . "%' | |
| OR pctabs.usercode = '" . $_SESSION['UserID'] . "' | |
| OR pctabs.assigner LIKE '%" . $_SESSION['UserID'] . "%' ) | |
| AND (FIND_IN_SET('" . $_SESSION['UserID'] . "', REPLACE(pctabs.authorizer, ' ', '')) > 0 | |
| OR pctabs.usercode = '" . $_SESSION['UserID'] . "' | |
| OR FIND_IN_SET('" . $_SESSION['UserID'] . "', REPLACE(pctabs.assigner, ' ', '')) > 0) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include(__DIR__ . '/includes/header.php'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '<p class="page_title_text"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/money_add.png" title="', __('Payment Entry'), '" alt="" />', ' ', $Title, ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/money_add.png" title="', $Title, '" alt="" />', ' ', $Title, ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </p>'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isset($_POST['SelectedTab'])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -63,14 +63,41 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $InputError = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prnMsg(__('You must select a tax group'), 'error'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($InputError == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $AuthorisersExpenses = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| foreach ($_POST['SelectAuthoriserExpenses'] as $Value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($i) $AuthorisersExpenses .= ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $AuthorisersExpenses .= $Value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $AuthorisersCash = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| foreach ($_POST['SelectAuthoriserCash'] as $Value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($i) $AuthorisersCash .= ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $AuthorisersCash .= $Value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Assigners = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| foreach ($_POST['SelectAssigner'] as $Value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($i) $Assigners .= ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Assigners .= $Value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+69
to
+89
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $i = 0; | |
| foreach ($_POST['SelectAuthoriserExpenses'] as $Value) { | |
| if ($i) $AuthorisersExpenses .= ','; | |
| $AuthorisersExpenses .= $Value; | |
| $i++; | |
| } | |
| $AuthorisersCash = ''; | |
| $i = 0; | |
| foreach ($_POST['SelectAuthoriserCash'] as $Value) { | |
| if ($i) $AuthorisersCash .= ','; | |
| $AuthorisersCash .= $Value; | |
| $i++; | |
| } | |
| $Assigners = ''; | |
| $i = 0; | |
| foreach ($_POST['SelectAssigner'] as $Value) { | |
| if ($i) $Assigners .= ','; | |
| $Assigners .= $Value; | |
| $i++; | |
| if (isset($_POST['SelectAuthoriserExpenses']) and is_array($_POST['SelectAuthoriserExpenses'])) { | |
| $AuthorisersExpenses = implode(',', $_POST['SelectAuthoriserExpenses']); | |
| } | |
| $AuthorisersCash = ''; | |
| if (isset($_POST['SelectAuthoriserCash']) and is_array($_POST['SelectAuthoriserCash'])) { | |
| $AuthorisersCash = implode(',', $_POST['SelectAuthoriserCash']); | |
| } | |
| $Assigners = ''; | |
| if (isset($_POST['SelectAssigner']) and is_array($_POST['SelectAssigner'])) { | |
| $Assigners = implode(',', $_POST['SelectAssigner']); |
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The select markup introduces a inside a block and drops the required attribute. This results in invalid HTML (unmatched table cell tags) and allows submitting with no selection. Remove the wrapper and keep required="required" on these multiple selects (or enforce selection server-side).
| <td><select multiple="multiple" name="SelectAssigner[]">'; | |
| <select multiple="multiple" name="SelectAssigner[]" required="required">'; |
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$Assigners is recalculated inside the option loop and explode() assumes $_POST['SelectAssigner'] is a string. After a submit, it will be an array (because of name="SelectAssigner[]"), which will cause a TypeError in PHP 8+. Compute selected IDs once before the loop and handle both the stored CSV string (edit mode) and the posted array (submit with errors).
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as the assigner select: explode() assumes a string but $_POST['SelectAuthoriserCash'] will be an array after submit, leading to a TypeError and broken re-rendering on validation errors. Normalize the selected values before the loop (handle both CSV string from DB and array from POST).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as the cash authoriser select: explode() will receive an array after submit (name="SelectAuthoriserExpenses[]"), causing a TypeError on re-render. Normalize selected values once outside the loop and handle both CSV string and array forms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
authorizerexpenses is now treated as a comma-separated list; using LIKE '%%' can match partial IDs and show tabs to the wrong users. Switch to delimiter-aware matching so only whole user IDs match.