From: <te...@us...> - 2015-11-16 09:15:27
|
Revision: 7392 http://sourceforge.net/p/web-erp/reponame/7392 Author: tehonu Date: 2015-11-16 09:15:24 +0000 (Mon, 16 Nov 2015) Log Message: ----------- New script to copy the authority in GL account - Users from one user to another Modified Paths: -------------- trunk/includes/MainMenuLinksArray.php trunk/sql/mysql/upgrade4.12.3-4.13.sql Added Paths: ----------- trunk/GLAccountUsersCopyAuthority.php Added: trunk/GLAccountUsersCopyAuthority.php =================================================================== --- trunk/GLAccountUsersCopyAuthority.php (rev 0) +++ trunk/GLAccountUsersCopyAuthority.php 2015-11-16 09:15:24 UTC (rev 7392) @@ -0,0 +1,88 @@ +<?php + +include ('includes/session.inc'); +$Title = _('GLAccount - Users Authority Copy Authority');// Screen identificator. +include('includes/header.inc'); +echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme, + '/images/maintenance.png" title="',// Icon image. + _('Copy Authority of GL Accounts from one user to another'), '" /> ',// Icon title. + _('Copy Authority of GL Accounts from one user to another'), '</p>';// Page title. + +include('includes/SQL_CommonFunctions.inc'); + +if(isset($_POST['ProcessCopyAuthority'])) { + + $InputError =0; + + if($_POST['FromUserID']==$_POST['ToUserID']) { + prnMsg(_('User FROM must be different from user TO'),'error'); + $InputError =1; + } + + if($InputError ==0) {// no input errors + $result = DB_Txn_Begin(); + + echo '<br />' . _('Deleting the current authority to view / update the GL Accounts of user') . ' ' . $_POST['ToUserID']; + $sql = "DELETE FROM glaccountusers WHERE userid = '" . $_POST['ToUserID'] . "'"; + $DbgMsg = _('The SQL statement that failed was'); + $ErrMsg =_('The SQL to delete the auhority in glaccountusers record failed'); + $result = DB_query($sql,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Copying the authority to view / update the GL Accounts from user') . ' ' . $_POST['FromUserID'] . ' ' . _('to') . ' ' . $_POST['ToUserID']; + $sql = "INSERT INTO glaccountusers (userid, accountcode, canview, canupd) + SELECT '" . $_POST['ToUserID'] . "', accountcode, canview, canupd + FROM glaccountusers + WHERE userid = '" . $_POST['FromUserID'] . "'"; + + $DbgMsg = _('The SQL statement that failed was'); + $ErrMsg =_('The SQL to insert the auhority in glaccountusers record failed'); + $result = DB_query($sql,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + echo '<br />'; + $result = DB_Txn_Commit(); + + }//only do the stuff above if $InputError==0 +} + +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<div class="centre">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table>'; +echo ' <tr> + <td>' . _('Select User to copy the Authority FROM') . ':</td> + <td><select name="FromUserID">'; +$Result = DB_query("SELECT userid, + realname + FROM www_users + ORDER BY userid"); + +echo '<option selected value="">' . _('Not Yet Selected') . '</option>'; +while ($MyRow = DB_fetch_array($Result)) { + echo '<option value="'; + echo $MyRow['userid'] . '">' . $MyRow['userid'] . ' - ' . $MyRow['realname'] . '</option>'; +} //end while loop +echo '</select></td></tr>'; + +echo ' <tr> + <td>' . _('Select User to copy the Authority TO') . ':</td> + <td><select name="ToUserID">'; +$Result = DB_query("SELECT userid, + realname + FROM www_users + ORDER BY userid"); + +echo '<option selected value="">' . _('Not Yet Selected') . '</option>'; +while ($MyRow = DB_fetch_array($Result)) { + echo '<option value="'; + echo $MyRow['userid'] . '">' . $MyRow['userid'] . ' - ' . $MyRow['realname'] . '</option>'; +} //end while loop +echo '</select></td></tr>'; +echo '</table>'; +echo '<input type="submit" name="ProcessCopyAuthority" value="' . _('Process Copy of Authority') . '" /> + </div> + </form>'; + +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/includes/MainMenuLinksArray.php =================================================================== --- trunk/includes/MainMenuLinksArray.php 2015-11-16 08:14:27 UTC (rev 7391) +++ trunk/includes/MainMenuLinksArray.php 2015-11-16 09:15:24 UTC (rev 7392) @@ -398,6 +398,7 @@ _('GL Tags'), _('GL Accounts Authorised Users Maintenance'), _('User Authorised GL Accounts Maintenance'), + _('Copy Authority GL Accounts from user A to B'), _('Bank Accounts'), _('Bank Account Authorised Users')); @@ -408,6 +409,7 @@ '/GLTags.php', '/GLAccountUsers.php', '/UserGLAccounts.php', + '/GLAccountUsersCopyAuthority.php', '/BankAccounts.php', '/BankAccountUsers.php'); Modified: trunk/sql/mysql/upgrade4.12.3-4.13.sql =================================================================== --- trunk/sql/mysql/upgrade4.12.3-4.13.sql 2015-11-16 08:14:27 UTC (rev 7391) +++ trunk/sql/mysql/upgrade4.12.3-4.13.sql 2015-11-16 09:15:24 UTC (rev 7392) @@ -23,7 +23,7 @@ `grns` (`grnno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO scripts VALUES('EmailCustStatements.php','3','Email customer statement to customer'); -INSERT INTO scripts VALUES('SupplierGRNAndInvoiceInquiry.php',5,'Supplier\'s delivery note and grn relationship inquiry'); +INSERT INTO scripts VALUES('SupplierGRNAndInvoiceInquiry.php',5,'Suppliers delivery note and grn relationship inquiry'); ALTER table grns ADD supplierref varchar(30) NOT NULL DEFAULT ''; CREATE TABLE IF NOT EXISTS `glaccountusers` ( @@ -49,5 +49,8 @@ ('GLAccountUsers.php', '15', 'Maintenance of users allowed to a GL Account'), ('UserGLAccounts.php', '15', 'Maintenance of GL Accounts allowed for a user'); +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES +('GLAccountUsersCopyAuthority.php', '15', 'Copy the authority into GL Accounts from user A to user B'); + -- Update version number: UPDATE config SET confvalue='4.13' WHERE confname='VersionNumber'; |