|
From: <ex...@us...> - 2016-04-01 08:36:05
|
Revision: 7482
http://sourceforge.net/p/web-erp/reponame/7482
Author: exsonqu
Date: 2016-04-01 08:36:03 +0000 (Fri, 01 Apr 2016)
Log Message:
-----------
01/04/2016 Exson: Make Petty cash assigner and authorizer multiple selectable in PcExpenses.php,PcTabs.php, PcAssignCashToTab.php and PcAuthorizeExpenses.
Modified Paths:
--------------
trunk/PcAssignCashToTab.php
trunk/PcAuthorizeExpenses.php
trunk/PcExpenses.php
trunk/PcTabs.php
Modified: trunk/PcAssignCashToTab.php
===================================================================
--- trunk/PcAssignCashToTab.php 2016-03-24 19:39:49 UTC (rev 7481)
+++ trunk/PcAssignCashToTab.php 2016-04-01 08:36:03 UTC (rev 7482)
@@ -163,9 +163,9 @@
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- $SQL = "SELECT tabcode
+ $SQL = "SELECT tabcode, assigner
FROM pctabs
- WHERE assigner='" . $_SESSION['UserID'] . "'
+ WHERE assigner LIKE '%" . $_SESSION['UserID'] . "%'
ORDER BY tabcode";
$result = DB_query($SQL);
@@ -175,12 +175,15 @@
echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ':</td>
<td><select name="SelectedTabs">';
while ($myrow = DB_fetch_array($result)) {
- if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) {
- echo '<option selected="selected" value="';
- } else {
- echo '<option value="';
+ $Assigner = explode(',',$myrow['assigner']);
+ if (in_array($_SESSION['UserID'],$Assigner)) {
+ if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) {
+ echo '<option selected="selected" value="';
+ } else {
+ echo '<option value="';
+ }
+ echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
}
- echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
}
echo '</select></td></tr>';
Modified: trunk/PcAuthorizeExpenses.php
===================================================================
--- trunk/PcAuthorizeExpenses.php 2016-03-24 19:39:49 UTC (rev 7481)
+++ trunk/PcAuthorizeExpenses.php 2016-04-01 08:36:03 UTC (rev 7482)
@@ -304,9 +304,9 @@
<br />
<table class="selection">'; //Main table
- $SQL = "SELECT tabcode
+ $SQL = "SELECT tabcode,authorizer
FROM pctabs
- WHERE authorizer='" . $_SESSION['UserID'] . "'";
+ WHERE authorizer LIKE '%" . $_SESSION['UserID'] . "%'";
$result = DB_query($SQL);
@@ -315,12 +315,14 @@
<td><select name="SelectedTabs" required="required" autofocus="autofocus" >';
while ($myrow = DB_fetch_array($result)) {
- if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) {
- echo '<option selected="selected" value="';
- } else {
- echo '<option value="';
- }
- echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
+ $Authorisers = explode(',',$myrow['authorizer']);
+ if (in_array($_SESSION['UserID'],$Authorisers)) {
+ if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) {
+ echo '<option selected="selected" value="';
+ } else {
+ echo '<option value="';
+ }
+ echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
} //end while loop get type of tab
Modified: trunk/PcExpenses.php
===================================================================
--- trunk/PcExpenses.php 2016-03-24 19:39:49 UTC (rev 7481)
+++ trunk/PcExpenses.php 2016-04-01 08:36:03 UTC (rev 7482)
@@ -186,11 +186,11 @@
echo '<table class="selection">';
echo '<tr>
- <th>' . _('Code Of Expense') . '</th>
- <th>' . _('Description') . '</th>
- <th>' . _('Account Code') . '</th>
- <th>' . _('Account Description') . '</th>
- <th>' . _('Tag') . '</th>
+ <th class="ascending">' . _('Code Of Expense') . '</th>
+ <th class="ascending">' . _('Description') . '</th>
+ <th class="ascending">' . _('Account Code') . '</th>
+ <th class="ascending">' . _('Account Description') . '</th>
+ <th class="ascending">' . _('Tag') . '</th>
</tr>';
$k=0; //row colour counter
@@ -358,4 +358,4 @@
include('includes/footer.inc');
-?>
\ No newline at end of file
+?>
Modified: trunk/PcTabs.php
===================================================================
--- trunk/PcTabs.php 2016-03-24 19:39:49 UTC (rev 7481)
+++ trunk/PcTabs.php 2016-04-01 08:36:03 UTC (rev 7482)
@@ -67,12 +67,12 @@
echo prnMsg(_('You must select a type of tab from the list'),'error');
$Errors[$i] = 'TabType';
$i++;
- } elseif (($_POST['SelectAssigner'])=='') {
+ } elseif (empty($_POST['SelectAssigner'])) {
$InputError = 1;
echo prnMsg(_('You must select a User to assign cash to this tab'),'error');
$Errors[$i] = 'AssignerName';
$i++;
- } elseif (($_POST['SelectAuthoriser'])=='') {
+ } elseif (empty($_POST['SelectAuthoriser'])) {
$InputError = 1;
echo prnMsg(_('You must select a User to authorise this tab'),'error');
$Errors[$i] = 'AuthoriserName';
@@ -88,15 +88,35 @@
$Errors[$i] = 'GLTab';
$i++;
}
+
+ if ($InputError == 0) {
+ $Authorisers = '';
+ $i = 0;
+ foreach ($_POST['SelectAuthoriser'] as $value) {
+ if ($i) $Authorisers .= ',';
+ $Authorisers .= $value;
+ $i++;
+ }
+ $Assigners = '';
+ $i = 0;
+ foreach ($_POST['SelectAssigner'] as $value) {
+ if ($i) $Assigners .= ',';
+ $Assigners .= $value;
+ $i++;
+ }
+ }
+
if (isset($SelectedTab) AND $InputError !=1) {
+ //get the authorisers value
+
$sql = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "',
typetabcode = '" . $_POST['SelectTabs'] . "',
currency = '" . $_POST['SelectCurrency'] . "',
tablimit = '" . filter_number_format($_POST['TabLimit']) . "',
- assigner = '" . $_POST['SelectAssigner'] . "',
- authorizer = '" . $_POST['SelectAuthoriser'] . "',
+ assigner = '" . $Assigners . "',
+ authorizer = '" . $Authorisers . "',
glaccountassignment = '" . $_POST['GLAccountCash'] . "',
glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "'
WHERE tabcode = '".$SelectedTab."'";
@@ -134,8 +154,8 @@
'" . $_POST['SelectTabs'] . "',
'" . $_POST['SelectCurrency'] . "',
'" . filter_number_format($_POST['TabLimit']) . "',
- '" . $_POST['SelectAssigner'] . "',
- '" . $_POST['SelectAuthoriser'] . "',
+ '" . $Assigners . "',
+ '" . $Authorisers . "',
'" . $_POST['GLAccountCash'] . "',
'" . $_POST['GLAccountPcashTab'] . "')";
@@ -383,7 +403,7 @@
echo '<tr>
<td>' . _('Assigner') . ':</td>
- <td><select name="SelectAssigner">';
+ <td><select multiple="multiple" name="SelectAssigner[]">';
$SQL = "SELECT userid,
realname
@@ -393,7 +413,8 @@
$result = DB_query($SQL);
while ($myrow = DB_fetch_array($result)) {
- if (isset($_POST['SelectAssigner']) and $myrow['userid']==$_POST['SelectAssigner']) {
+ $Assigners = explode(',',$_POST['SelectAssigner']);
+ if (isset($_POST['SelectAssigner']) and in_array($myrow['userid'],$Assigners)) {
echo '<option selected="selected" value="';
} else {
echo '<option value="';
@@ -408,7 +429,7 @@
echo '<tr>
<td>' . _('Authoriser') . ':</td>
- <td><select name="SelectAuthoriser">';
+ <td><select multiple="multiple" name="SelectAuthoriser[]">';
$SQL = "SELECT userid,
realname
@@ -418,7 +439,8 @@
$result = DB_query($SQL);
while ($myrow = DB_fetch_array($result)) {
- if (isset($_POST['SelectAuthoriser']) and $myrow['userid']==$_POST['SelectAuthoriser']) {
+ $Authorizer = explode(',',$_POST['SelectAuthoriser']);
+ if (isset($_POST['SelectAuthoriser']) and in_array($myrow['userid'],$Authorizer)) {
echo '<option selected="selected" value="';
} else {
echo '<option value="';
@@ -493,4 +515,4 @@
} // end if user wish to delete
include('includes/footer.inc');
-?>
\ No newline at end of file
+?>
|