From 2b7ec1f4db425a1d9851e9278d51cebba8dce0b2 Mon Sep 17 00:00:00 2001 From: Tim Schofield Date: Sat, 9 Nov 2024 22:34:32 +0000 Subject: [PATCH] Table wasn't sorting properly, and wasn't displaying striped Files changed in commit: PO_AuthorisationLevels.php --- PO_AuthorisationLevels.php | 116 +++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/PO_AuthorisationLevels.php b/PO_AuthorisationLevels.php index efe759a6c..1e47894c8 100644 --- a/PO_AuthorisationLevels.php +++ b/PO_AuthorisationLevels.php @@ -33,14 +33,14 @@ if ($_POST['AuthLevel']=='') { $_POST['AuthLevel']=0; } - $sql="SELECT COUNT(*) + $SQL="SELECT COUNT(*) FROM purchorderauth WHERE userid='" . $_POST['UserID'] . "' AND currabrev='" . $_POST['CurrCode'] . "'"; - $result=DB_query($sql); - $myrow=DB_fetch_array($result); - if ($myrow[0]==0) { - $sql="INSERT INTO purchorderauth ( userid, + $Result=DB_query($SQL); + $MyRow=DB_fetch_array($Result); + if ($MyRow[0]==0) { + $SQL="INSERT INTO purchorderauth ( userid, currabrev, cancreate, offhold, @@ -51,7 +51,7 @@ '".$OffHold."', '" . filter_number_format($_POST['AuthLevel'])."')"; $ErrMsg = _('The authentication details cannot be inserted because'); - $Result=DB_query($sql,$ErrMsg); + $Result=DB_query($SQL,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); echo '
'; @@ -69,7 +69,7 @@ } else { $OffHold=1; } - $sql="UPDATE purchorderauth SET + $SQL="UPDATE purchorderauth SET cancreate='".$CanCreate."', offhold='".$OffHold."', authlevel='".filter_number_format($_POST['AuthLevel'])."' @@ -77,36 +77,36 @@ AND currabrev='".$_POST['CurrCode']."'"; $ErrMsg = _('The authentication details cannot be updated because'); - $Result=DB_query($sql,$ErrMsg); + $Result=DB_query($SQL,$ErrMsg); } if (isset($_GET['Delete'])) { - $sql="DELETE FROM purchorderauth + $SQL="DELETE FROM purchorderauth WHERE userid='".$_GET['UserID']."' AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be deleted because'); - $Result=DB_query($sql,$ErrMsg); + $Result=DB_query($SQL,$ErrMsg); } if (isset($_GET['Edit'])) { - $sql="SELECT cancreate, + $SQL="SELECT cancreate, offhold, authlevel FROM purchorderauth WHERE userid='".$_GET['UserID']."' AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); - $result=DB_query($sql,$ErrMsg); - $myrow=DB_fetch_array($result); + $Result=DB_query($SQL,$ErrMsg); + $MyRow=DB_fetch_array($Result); $UserID=$_GET['UserID']; $Currency=$_GET['Currency']; - $CanCreate=$myrow['cancreate']; - $OffHold=$myrow['offhold']; - $AuthLevel=$myrow['authlevel']; + $CanCreate=$MyRow['cancreate']; + $OffHold=$MyRow['offhold']; + $AuthLevel=$MyRow['authlevel']; } -$sql="SELECT purchorderauth.userid, +$SQL="SELECT purchorderauth.userid, www_users.realname, currencies.currabrev, currencies.currency, @@ -120,45 +120,47 @@ ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); -$Result=DB_query($sql,$ErrMsg); +$Result=DB_query($SQL,$ErrMsg); echo ' - - - - - - - - - '; + + + + + + + + + + + '; -while ($myrow=DB_fetch_array($Result)) { - if ($myrow['cancreate']==0) { +while ($MyRow=DB_fetch_array($Result)) { + if ($MyRow['cancreate']==0) { $DisplayCanCreate=_('Yes'); } else { $DisplayCanCreate=_('No'); } - if ($myrow['offhold']==0) { + if ($MyRow['offhold']==0) { $DisplayOffHold=_('Yes'); } else { $DisplayOffHold=_('No'); } - echo ' - - - + echo ' + + + - - - + + + '; } -echo '
' . _('User ID') . '' . _('User Name') . '' . _('Currency') . '' . _('Create Order') . '' . _('Can Release') . '
' . _('Invoices') . '
' . _('Authority Level') . ' 
' . _('User ID') . '' . _('User Name') . '' . _('Currency') . '' . _('Create Order') . '' . _('Can Release') . '
' . _('Invoices') . '
' . _('Authority Level') . ' 
' . $myrow['userid'] . '' . $myrow['realname'] . '', _($myrow['currency']), '
' . $MyRow['userid'] . '' . $MyRow['realname'] . '', _($MyRow['currency']), ' ' . $DisplayCanCreate . ' ' . $DisplayOffHold . '' . locale_number_format($myrow['authlevel'],$myrow['decimalplaces']) . '' . _('Edit') . '' . _('Delete') . '' . locale_number_format($MyRow['authlevel'],$MyRow['decimalplaces']) . '' . _('Edit') . '' . _('Delete') . '


'; +echo ''; if (!isset($_GET['Edit'])) { $UserID=$_SESSION['UserID']; @@ -185,11 +187,11 @@ @@ -197,7 +199,7 @@ } if (isset($_GET['Edit'])) { - $sql="SELECT cancreate, + $SQL="SELECT cancreate, offhold, authlevel, currency, @@ -207,18 +209,18 @@ WHERE userid='".$_GET['UserID']."' AND purchorderauth.currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); - $result=DB_query($sql,$ErrMsg); - $myrow=DB_fetch_array($result); + $Result=DB_query($SQL,$ErrMsg); + $MyRow=DB_fetch_array($Result); $UserID=$_GET['UserID']; $Currency=$_GET['Currency']; - $CanCreate=$myrow['cancreate']; - $OffHold=$myrow['offhold']; - $AuthLevel=$myrow['authlevel']; - $CurrDecimalPlaces=$myrow['decimalplaces']; + $CanCreate=$MyRow['cancreate']; + $OffHold=$MyRow['offhold']; + $AuthLevel=$MyRow['authlevel']; + $CurrDecimalPlaces=$MyRow['decimalplaces']; echo ' - ' . $myrow['currency'] . ' + ' . $MyRow['currency'] . ' '; echo ''; } else { @@ -227,14 +229,14 @@ '; }