From: <dai...@us...> - 2013-06-29 07:13:26
|
Revision: 6040 http://sourceforge.net/p/web-erp/reponame/6040 Author: daintree Date: 2013-06-29 07:13:22 +0000 (Sat, 29 Jun 2013) Log Message: ----------- missing Manufacturers.php script for setting up brands for salescategories Modified Paths: -------------- trunk/CustWhereAlloc.php trunk/Customers.php trunk/UpgradeDatabase.php trunk/includes/ConnectDB.inc trunk/sql/mysql/upgrade4.10-4.11.sql Added Paths: ----------- trunk/Manufacturers.php Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2013-06-29 06:21:41 UTC (rev 6039) +++ trunk/CustWhereAlloc.php 2013-06-29 07:13:22 UTC (rev 6040) @@ -28,9 +28,9 @@ } if ($_POST['TransType']==10){ echo '<option selected="selected" value="10">' . _('Invoices') . '</option> - <option value="12">' . _('Receipts') . '</option>'; + <option value="12">' . _('Negative Receipts (Payments)') . '</option>'; } else { - echo '<option selected="selected" value="12">' . _('Receipts') . '</option> + echo '<option selected="selected" value="12">' . _('Negative Receipts (Payments)') . '</option> <option selected="selected" value="10">' . _('Invoices') . '</option>'; } @@ -91,7 +91,12 @@ $TransResult = DB_query($sql, $db, $ErrMsg); if (DB_num_rows($TransResult)==0){ - prnMsg(_('There are no allocations made against this transaction'),'info'); + + if ($myrow['totamt']<0 AND $_POST['TransType']==12){ + prnMsg(_('This transaction was a receipt of funds and there can be no allocations of receipts or credits to a receipt. This inquiry is meant to be used to see how a payment which is entered as a negative receipt is settled against credit notes or receipts'),'info'); + } else { + prnMsg(_('There are no allocations made against this transaction'),'info'); + } } else { echo '<br /> <table class="selection">'; Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2013-06-29 06:21:41 UTC (rev 6039) +++ trunk/Customers.php 2013-06-29 07:13:22 UTC (rev 6040) @@ -374,11 +374,6 @@ } else { $ID=''; } -if (isset($_POST['ws'])){ //ws??? wtf??? - $ws = $_POST['ws']; -} elseif (isset($_GET['ws'])){ - $ws = $_GET['ws']; -} if (isset($_POST['Edit'])){ $Edit = $_POST['Edit']; } elseif (isset($_GET['Edit'])){ Added: trunk/Manufacturers.php =================================================================== --- trunk/Manufacturers.php (rev 0) +++ trunk/Manufacturers.php 2013-06-29 07:13:22 UTC (rev 6040) @@ -0,0 +1,320 @@ +<?php + + +/* $Id: Manufacturers.php 5498 2012-07-13 08:35:54Z tehonu $*/ + +include('includes/session.inc'); + +$Title = _('Brands Maintenance'); + +include('includes/header.inc'); + +if (isset($_GET['SelectedManufacturer'])){ + $SelectedManufacturer = $_GET['SelectedManufacturer']; +} elseif (isset($_POST['SelectedManufacturer'])){ + $SelectedManufacturer = $_POST['SelectedManufacturer']; +} + +if (isset($_POST['submit'])) { + + + //initialise no input errors assumed initially before we test + $InputError = 0; + + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + + if (isset($SelectedManufacturer) AND $InputError !=1) { + + if (isset($_FILES['BrandPicture']) AND $_FILES['BrandPicture']['name'] !='') { + + $result = $_FILES['BrandPicture']['error']; + $UploadTheFile = 'Yes'; //Assume all is well to start off with + $FileName = $_SESSION['part_pics_dir'] . '/BRAND-' . $SelectedManufacturer . '.jpg'; + + //But check for the worst + if (mb_strtoupper(mb_substr(trim($_FILES['BrandPicture']['name']),mb_strlen($_FILES['BrandPicture']['name'])-3))!='JPG'){ + prnMsg(_('Only jpg files are supported - a file extension of .jpg is expected'),'warn'); + $UploadTheFile ='No'; + } elseif ( $_FILES['BrandPicture']['size'] > ($_SESSION['MaxImageSize']*1024)) { //File Size Check + prnMsg(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $_SESSION['MaxImageSize'],'warn'); + $UploadTheFile ='No'; + } elseif ( $_FILES['BrandPicture']['type'] == 'text/plain' ) { //File Type Check + prnMsg( _('Only graphics files can be uploaded'),'warn'); + $UploadTheFile ='No'; + } elseif (file_exists($FileName)){ + prnMsg(_('Attempting to overwrite an existing item image'),'warn'); + $result = unlink($FileName); + if (!$result){ + prnMsg(_('The existing image could not be removed'),'error'); + $UploadTheFile ='No'; + } + } + + if ($UploadTheFile=='Yes'){ + $result = move_uploaded_file($_FILES['BrandPicture']['tmp_name'], $FileName); + $message = ($result)?_('File url') .'<a href="' . $FileName .'">' . $FileName . '</a>' : _('Something is wrong with uploading a file'); + $_POST['ManufacturersImage'] = 'BRAND-' . $SelectedManufacturer; + } else { + $_POST['ManufacturersImage'] = ''; + } + } + if( isset($_POST['ManufacturersImage'])){ + if (file_exists($_SESSION['part_pics_dir'] . '/' .'BRAND-' . $SelectedManufacturer . '.jpg') ) { + $_POST['ManufacturersImage'] = 'BRAND-' . $SelectedManufacturer . '.jpg'; + } else { + $_POST['ManufacturersImage'] = ''; + } + } + + $sql = "UPDATE manufacturers SET manufacturers_name='" . $_POST['ManufacturersName'] . "', + manufacturers_url='" . $_POST['ManufacturersURL'] . "'"; + if (isset($_POST['ManufacturersImage'])){ + $sql .= ", manufacturers_image='" . $_POST['ManufacturersImage'] . "'"; + } + $sql .= " WHERE manufacturers_id = '" . $SelectedManufacturer . "'"; + + $ErrMsg = _('An error occurred updating the') . ' ' . $SelectedManufacturer . ' ' . _('manufacturer record because'); + $DbgMsg = _('The SQL used to update the manufacturer record was'); + + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + + prnMsg( _('The manufacturer record has been updated'),'success'); + unset($_POST['ManufacturersName']); + unset($_POST['ManufacturersURL']); + unset($_POST['ManufacturersImage']); + unset($SelectedManufacturer); + + } elseif ($InputError !=1) { + + /*SelectedManufacturer is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Location form */ + + $sql = "INSERT INTO manufacturers (manufacturers_name, + manufacturers_url) + VALUES ('" . $_POST['ManufacturersName'] . "', + '" . $_POST['ManufacturersURL'] . "')"; + + $ErrMsg = _('An error occurred inserting the new manufacturer record because'); + $DbgMsg = _('The SQL used to insert the manufacturer record was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + + if (isset($_FILES['BrandPicture']) AND $_FILES['BrandPicture']['name'] !='') { + + $result = $_FILES['BrandPicture']['error']; + $UploadTheFile = 'Yes'; //Assume all is well to start off with + $FileName = $_SESSION['part_pics_dir'] . '/BRAND-' . $_SESSION['LastInsertId'] . '.jpg'; + + //But check for the worst + if (mb_strtoupper(mb_substr(trim($_FILES['BrandPicture']['name']),mb_strlen($_FILES['BrandPicture']['name'])-3))!='JPG'){ + prnMsg(_('Only jpg files are supported - a file extension of .jpg is expected'),'warn'); + $UploadTheFile ='No'; + } elseif ( $_FILES['BrandPicture']['size'] > ($_SESSION['MaxImageSize']*1024)) { //File Size Check + prnMsg(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $_SESSION['MaxImageSize'],'warn'); + $UploadTheFile ='No'; + } elseif ( $_FILES['BrandPicture']['type'] == 'text/plain' ) { //File Type Check + prnMsg( _('Only graphics files can be uploaded'),'warn'); + $UploadTheFile ='No'; + } elseif (file_exists($FileName)){ + prnMsg(_('Attempting to overwrite an existing item image'),'warn'); + $result = unlink($FileName); + if (!$result){ + prnMsg(_('The existing image could not be removed'),'error'); + $UploadTheFile ='No'; + } + } + + if ($UploadTheFile=='Yes'){ + $result = move_uploaded_file($_FILES['BrandPicture']['tmp_name'], $FileName); + $message = ($result)?_('File url') .'<a href="' . $FileName .'">' . $FileName . '</a>' : _('Something is wrong with uploading a file'); + DB_query("UPDATE manufacturers SET manufacturers_image='" . $FileName . "'",$db); + } + } + + prnMsg( _('The new manufacturer record has been added'),'success'); + + unset($_POST['ManufacturersName']); + unset($_POST['ManufacturersURL']); + unset($_POST['ManufacturersImage']); + unset($SelectedManufacturer); + } + + +} elseif (isset($_GET['delete'])) { +//the link to delete a selected record was clicked instead of the submit button + + $CancelDelete = false; + +// PREVENT DELETES IF DEPENDENT RECORDS + $sql= "SELECT COUNT(*) FROM salescatprod WHERE manufacturers_id='". $SelectedManufacturer . "'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + $CancelDelete = true; + prnMsg( _('Cannot delete this manufacturer because products have been defined as from this manufacturer'),'warn'); + echo _('There are') . ' ' . $myrow[0] . ' ' . _('items with this manufacturer code'); + } + + if (!$CancelDelete) { + + $result = DB_query("DELETE FROM manufacturers WHERE manufacturers_id='" . $SelectedManufacturer . "'",$db); + if( file_exists($_SESSION['part_pics_dir'] . '/BRAND-' . $SelectedManufacturer . '.jpg') ) { + unlink($_SESSION['part_pics_dir'] . '/BRAND-' . $SelectedManufacturer . '.jpg'); + } + prnMsg( _('Manufacturer') . ' ' . $SelectedManufacturer . ' ' . _('has been deleted') . '!', 'success'); + unset ($SelectedManufacturer); + } //end if Delete Manufacturer + unset($SelectedManufacturer); + unset($_GET['delete']); +} + +if (!isset($SelectedManufacturer)) { + +/* It could still be the second time the page has been run and a record has been selected for modification - SelectedManufacturer will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters +then none of the above are true and the list of Manufacturers will be displayed with +links to delete or edit each. These will call the same page again and allow update/input +or deletion of the records*/ + + $sql = "SELECT manufacturers_id, + manufacturers_name, + manufacturers_url, + manufacturers_image + FROM manufacturers"; + $result = DB_query($sql,$db); + + if (DB_num_rows($result)==0){ + prnMsg (_('There are no manufacturers to display'),'error'); + } + echo '<p class="page_Title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" Title="' . + _('Manufacturers') . '" alt="" />' . ' ' . $Title . '</p>'; + + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Brand Code') . '</th> + <th>' . _('Brand Name') . '</th> + <th>' . _('Brand URL') . '</th> + <th>' . _('Brands Image') . '</th> + </tr>'; + +$k=0; //row colour counter +while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + if( file_exists($_SESSION['part_pics_dir'] . '/BRAND-' . $myrow['manufacturers_id'] . '.jpg') ) { + $BrandImgLink = '<img width="120" height="120" src="' . $_SESSION['part_pics_dir'] . '/BRAND-' . $myrow['manufacturers_id'] . '.jpg" />'; + } else { + $BrandImgLink = _('No Image'); + } + printf('<td>%s</td> + <td>%s</td> + <td><a target="_blank" href="%s">%s</a></td> + <td>%s</td> + <td><a href="%sSelectedManufacturer=%s">' . _('Edit') . '</a></td> + <td><a href="%sSelectedManufacturer=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this brand?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['manufacturers_id'], + $myrow['manufacturers_name'], + $myrow['manufacturers_url'], + $myrow['manufacturers_url'], + $BrandImgLink, + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $myrow['manufacturers_id'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', + $myrow['manufacturers_id']); + + } + //END WHILE LIST LOOP + echo '</table>'; +} + +//end of ifs and buts! + +echo '<br />'; +if (isset($SelectedManufacturer)) { + echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Review Records') . '</a>'; +} +echo '<br />'; + +if (!isset($_GET['delete'])) { + + echo '<form enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + if (isset($SelectedManufacturer)) { + //editing an existing Brand + echo '<p class="page_Title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" Title="' . + _('Brand') . '" alt="" />' . ' ' . $Title . '</p>'; + + $sql = "SELECT manufacturers_id, + manufacturers_name, + manufacturers_url, + manufacturers_image + FROM manufacturers + WHERE manufacturers_id='" . $SelectedManufacturer . "'"; + + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + + $_POST['ManufacturersName'] = $myrow['manufacturers_name']; + $_POST['ManufacturersURL'] = $myrow['manufacturers_url']; + $_POST['ManufacturersImage'] = $myrow['manufacturers_image']; + + + echo '<input type="hidden" name="SelectedManufacturer" value="' . $SelectedManufacturer . '" />'; + echo '<table class="selection">'; + echo '<tr> + <th colspan="2">'._('Amend Brand Details').'</th> + </tr>'; + } else { //end of if $SelectedManufacturer only do the else when a new record is being entered + + echo '<table class="selection"> + <tr> + <th colspan="2"><h3>'._('New Brand/Manufacturer Details').'</h3></th> + </tr>'; + } + if (!isset($_POST['ManufacturersName'])) { + $_POST['ManufacturersName'] = ''; + } + if (!isset($_POST['ManufacturersURL'])) { + $_POST['ManufacturersURL'] = ' '; + } + if (!isset($_POST['ManufacturersImage'])) { + $_POST['ManufacturersImage'] = ''; + } + + echo '<tr> + <td>' . _('Brand Name') . ':' . '</td> + <td><input type="text" name="ManufacturersName" value="'. $_POST['ManufacturersName'] . '" size="32" maxlength="32" /></td> + </tr> + <tr> + <td>' . _('Brand URL') . ':' . '</td> + <td><input type="text" name="ManufacturersURL" value="' . $_POST['ManufacturersURL'] . '" size="50" maxlength="50" /></td> + </tr> + <tr> + <td>'. _('Brand Image File (.jpg)') . ':</td> + <td><input type="file" id="BrandPicture" name="BrandPicture" /></td> + </tr>'; + if (isset($SelectedManufacturer)){ + if(file_exists($_SESSION['part_pics_dir'] . '/' .'BRAND-' . $SelectedManufacturer . '.jpg') ) { + echo '</tr><td colspan="2"><img width="100" height="100" src="' . $_SESSION['part_pics_dir'] . '/' .'BRAND-' . $SelectedManufacturer . '.jpg" /></tr></tr>'; + } + } + + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Enter Information') . '" /> + </div> + </div> + </form>'; + +} //end if record deleted no point displaying form to add record + +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2013-06-29 06:21:41 UTC (rev 6039) +++ trunk/UpgradeDatabase.php 2013-06-29 07:13:22 UTC (rev 6040) @@ -175,6 +175,8 @@ } $SQLScripts[] = './sql/mysql/upgrade4.09-4.10.sql'; case '4.10.1': + $SQLScripts[] = './sql/mysql/upgrade4.10-4.11.sql'; + case '4.11.0': break; } //end switch } Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2013-06-29 06:21:41 UTC (rev 6039) +++ trunk/includes/ConnectDB.inc 2013-06-29 07:13:22 UTC (rev 6040) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='4.10.1'; //must update manually every time there is a DB change +$Version='4.11.0'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); Modified: trunk/sql/mysql/upgrade4.10-4.11.sql =================================================================== --- trunk/sql/mysql/upgrade4.10-4.11.sql 2013-06-29 06:21:41 UTC (rev 6039) +++ trunk/sql/mysql/upgrade4.10-4.11.sql 2013-06-29 07:13:22 UTC (rev 6040) @@ -1,162 +1,163 @@ -INSERT INTO config VALUES('SmtpSetting',0); -ALTER TABLE `companies` CHANGE `debtorsact` `debtorsact` VARCHAR( 20 ) NOT NULL DEFAULT '70000', -CHANGE `pytdiscountact` `pytdiscountact` VARCHAR( 20 ) NOT NULL DEFAULT '55000', -CHANGE `creditorsact` `creditorsact` VARCHAR( 20 ) NOT NULL DEFAULT '80000', -CHANGE `payrollact` `payrollact` VARCHAR( 20 ) NOT NULL DEFAULT '84000', -CHANGE `grnact` `grnact` VARCHAR( 20 ) NOT NULL DEFAULT '72000', -CHANGE `exchangediffact` `exchangediffact` VARCHAR( 20 ) NOT NULL DEFAULT '65000', -CHANGE `purchasesexchangediffact` `purchasesexchangediffact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `retainedearnings` `retainedearnings` VARCHAR( 20 ) NOT NULL DEFAULT '90000', -CHANGE `freightact` `freightact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `lastcostrollup` CHANGE `stockact` `stockact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `adjglact` `adjglact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `salesglpostings` CHANGE `discountglcode` `discountglcode` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `salesglcode` `salesglcode` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `cogsglpostings` CHANGE `glcode` `glcode` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `fixedassetcategories` CHANGE `costact` `costact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `depnact` `depnact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `disposalact` `disposalact` VARCHAR( 20 ) NOT NULL DEFAULT '80000', -CHANGE `accumdepnact` `accumdepnact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `purchorderdetails` CHANGE `glcode` `glcode` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `stockcategory` CHANGE `stockact` `stockact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `adjglact` `adjglact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `issueglact` `issueglact` VARCHAR( 20 ) NOT NULL DEFAULT '0', -CHANGE `purchpricevaract` `purchpricevaract` VARCHAR( 20 ) NOT NULL DEFAULT '80000', -CHANGE `materialuseagevarac` `materialuseagevarac` VARCHAR( 20 ) NOT NULL DEFAULT '80000', -CHANGE `wipact` `wipact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `workcentres` CHANGE `overheadrecoveryact` `overheadrecoveryact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; - -INSERT INTO `scripts` (`script` , `pagesecurity` , `description`) -VALUES ('Z_ChangeGLAccountCode.php', '15', 'Script to change a GL account code accross all tables necessary'); - -ALTER TABLE `currencies` ADD `webcart` TINYINT( 1 ) NOT NULL DEFAULT '1' COMMENT 'If 1 shown in weberp cart. if 0 no show'; - -ALTER TABLE `salescat` CHANGE `salescatname` `salescatname` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; -CREATE TABLE `mailgroups` ( id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - groupname varchar(100) NOT NULL, - unique (groupname)) ENGINE = InnoDB DEFAULT CHARSET = utf8; -CREATE TABLE `mailgroupdetails` (groupname varchar(100) NOT NULL, - userid varchar(20) NOT NULL, - CONSTRAINT FOREIGN KEY (`groupname`) REFERENCES `mailgroups` (`groupname`), - CONSTRAINT FOREIGN KEY (`userid`) REFERENCES `www_users`(`userid`), - INDEX(`groupname`)) Engine=InnoDB DEFAULT CHARSET=utf8; - -INSERT INTO scripts VALUES('MailingGroupMaintenance.php', 15, 'Mainting mailing lists for items to mail'); - -INSERT INTO mailgroups VALUES(1,'ChkListingRecipients'); -INSERT INTO mailgroups VALUES(2,'SalesAnalysisReportRecipients'); -INSERT INTO scripts VALUES('MailSalesReport_csv.php',15,'Mailing the sales report'); -INSERT INTO mailgroups VALUES(3,'OffersReceivedResultRecipients'); -INSERT INTO mailgroups VALUES(4,'InventoryValuationRecipients'); -ALTER TABLE stockrequestitems DROP PRIMARY KEY; -ALTER TABLE stockrequestitems ADD PRIMARY KEY (`dispatchitemsid`,`dispatchid`); -INSERT INTO scripts VALUES('Z_ImportGLTransactions.php', 15, 'Import General Ledger Transactions'); -CREATE TABLE IF NOT EXISTS `fixedassettasks` ( - `taskid` int(11) NOT NULL AUTO_INCREMENT, - `assetid` int(11) NOT NULL, - `taskdescription` text NOT NULL, - `frequencydays` int(11) NOT NULL DEFAULT '365', - `lastcompleted` date NOT NULL, - `userresponsible` varchar(20) NOT NULL, - `manager` varchar(20) NOT NULL DEFAULT '', - PRIMARY KEY (`taskid`), - KEY `assetid` (`assetid`), - KEY `userresponsible` (`userresponsible`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('MaintenanceTasks.php', '1', 'Allows set up and edit of scheduled maintenance tasks'); -INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('MaintenanceUserSchedule.php', '1', 'List users or managers scheduled maintenance tasks and allow to be flagged as completed'); -INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('MaintenanceReminders.php', '1', 'Sends email reminders for scheduled asset maintenance tasks'); -INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('ImportBankTransAnalysis.php', '11', 'Allows analysis of bank transactions being imported'); -INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('ImportBankTrans.php', '11', 'Imports bank transactions'); -INSERT INTO scripts VALUES ('Manufacturers.php','15','Maintain brands of sales products'); -INSERT INTO scripts VALUES ('SalesCategoryDescriptions.php','15','Maintain translations for sales categories'); -INSERT INTO scripts VALUES ('ShopParameters.php','15','Maintain web-store configuration and set up'); - -INSERT INTO config VALUES ('ShopName',''); -INSERT INTO config VALUES ('ShopPrivacyStatement',''); -INSERT INTO config VALUES ('ShopFreightPolicy',''); -INSERT INTO config VALUES ('ShopTermsConditions',''); -INSERT INTO config VALUES ('ShopDebtorNo',''); -INSERT INTO config VALUES ('ShopBranchCode',''); -INSERT INTO config VALUES ('ShopAboutUs',''); - -INSERT INTO config VALUES ('ShopPayPalUser',''); -INSERT INTO config VALUES ('ShopPayPalPassword',''); -INSERT INTO config VALUES ('ShopPayPalSignature',''); - -INSERT INTO config VALUES ('ShopPayPalProUser',''); -INSERT INTO config VALUES ('ShopPayPalProPassword',''); -INSERT INTO config VALUES ('ShopPayPalProSignature',''); - -INSERT INTO config VALUES ('ShopCreditCardGateway', 'PayFlowPro'); - -INSERT INTO config VALUES ('ShopPayFlowUser',''); -INSERT INTO config VALUES ('ShopPayFlowPassword',''); -INSERT INTO config VALUES ('ShopPayFlowVendor',''); - -INSERT INTO config VALUES ('ShopAllowPayPal', '1'); -INSERT INTO config VALUES ('ShopAllowCreditCards', '1'); -INSERT INTO config VALUES ('ShopAllowBankTransfer', '1'); -INSERT INTO config VALUES ('ShopAllowSurcharges', '1'); - -INSERT INTO config VALUES ('ShopPayPalSurcharge', '0.034'); -INSERT INTO config VALUES ('ShopBankTransferSurcharge', '0.0'); -INSERT INTO config VALUES ('ShopCreditCardSurcharge', '0.029'); - -INSERT INTO config VALUES ('ShopPayPalBankAccount', '1030'); -INSERT INTO config VALUES ('ShopCreditCardBankAccount', '1030'); - -INSERT INTO config VALUES ('ShopSwipeHQMerchantID', ''); -INSERT INTO config VALUES ('ShopSwipeHQAPIKey', ''); - -INSERT INTO config VALUES ('ShopSurchargeStockID', ''); - -INSERT INTO config VALUES ('ItemDescriptionLanguages',''); -INSERT INTO config VALUES('SmtpSetting',0); - -CREATE TABLE IF NOT EXISTS `stockdescriptiontranslations` ( - `stockid` varchar(20) NOT NULL DEFAULT '', - `language_id` varchar(10) NOT NULL DEFAULT 'en_GB.utf8', - `descriptiontranslation` varchar(50) NOT NULL, - PRIMARY KEY (`stockid`,`language_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `debtorsmaster` ADD `language_id` VARCHAR( 10 ) NOT NULL DEFAULT 'en_GB.utf8'; - -ALTER TABLE `debtortrans` ADD `salesperson` VARCHAR( 4 ) NOT NULL DEFAULT '' , ADD INDEX ( `salesperson` ); -UPDATE debtortrans INNER JOIN salesorders ON debtortrans.order_=salesorders.orderno SET debtortrans.salesperson=salesorders.salesperson; -UPDATE debtortrans INNER JOIN custbranch ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode SET debtortrans.salesperson=custbranch.salesman WHERE debtortrans.type=11; - -CREATE TABLE IF NOT EXISTS `manufacturers` ( - `manufacturers_id` int(11) NOT NULL AUTO_INCREMENT, - `manufacturers_name` varchar(32) NOT NULL, - `manufacturers_url` varchar(50) NOT NULL DEFAULT '', - `manufacturers_image` varchar(64) DEFAULT NULL, - PRIMARY KEY (`manufacturers_id`), - KEY (`manufacturers_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `salescattranslations` ( - `salescatid` tinyint(4) NOT NULL DEFAULT '0', - `language_id` varchar(10) NOT NULL DEFAULT 'en_GB.utf8', - `salescattranslation` varchar(40) NOT NULL, - PRIMARY KEY (`salescatid`,`language_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE salescatprod ADD COLUMN manufacturers_id int(11) NOT NULL; -ALTER TABLE salescatprod ADD COLUMN featured int(11) DEFAULT '0' NOT NULL; -ALTER TABLE `salescatprod` ADD INDEX ( `manufacturers_id` ); - -INSERT INTO config VALUES ('ShopMode','test'); -INSERT INTO config VALUES ('ShopContactUs',''); - -UPDATE config SET confvalue='4.11.0' WHERE confname='Version'; - +INSERT INTO config VALUES('SmtpSetting',0); +ALTER TABLE `companies` CHANGE `debtorsact` `debtorsact` VARCHAR( 20 ) NOT NULL DEFAULT '70000', +CHANGE `pytdiscountact` `pytdiscountact` VARCHAR( 20 ) NOT NULL DEFAULT '55000', +CHANGE `creditorsact` `creditorsact` VARCHAR( 20 ) NOT NULL DEFAULT '80000', +CHANGE `payrollact` `payrollact` VARCHAR( 20 ) NOT NULL DEFAULT '84000', +CHANGE `grnact` `grnact` VARCHAR( 20 ) NOT NULL DEFAULT '72000', +CHANGE `exchangediffact` `exchangediffact` VARCHAR( 20 ) NOT NULL DEFAULT '65000', +CHANGE `purchasesexchangediffact` `purchasesexchangediffact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `retainedearnings` `retainedearnings` VARCHAR( 20 ) NOT NULL DEFAULT '90000', +CHANGE `freightact` `freightact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `lastcostrollup` CHANGE `stockact` `stockact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `adjglact` `adjglact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `salesglpostings` CHANGE `discountglcode` `discountglcode` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `salesglcode` `salesglcode` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `cogsglpostings` CHANGE `glcode` `glcode` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `fixedassetcategories` CHANGE `costact` `costact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `depnact` `depnact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `disposalact` `disposalact` VARCHAR( 20 ) NOT NULL DEFAULT '80000', +CHANGE `accumdepnact` `accumdepnact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `purchorderdetails` CHANGE `glcode` `glcode` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `stockcategory` CHANGE `stockact` `stockact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `adjglact` `adjglact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `issueglact` `issueglact` VARCHAR( 20 ) NOT NULL DEFAULT '0', +CHANGE `purchpricevaract` `purchpricevaract` VARCHAR( 20 ) NOT NULL DEFAULT '80000', +CHANGE `materialuseagevarac` `materialuseagevarac` VARCHAR( 20 ) NOT NULL DEFAULT '80000', +CHANGE `wipact` `wipact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `workcentres` CHANGE `overheadrecoveryact` `overheadrecoveryact` VARCHAR( 20 ) NOT NULL DEFAULT '0'; + +INSERT INTO `scripts` (`script` , `pagesecurity` , `description`) +VALUES ('Z_ChangeGLAccountCode.php', '15', 'Script to change a GL account code accross all tables necessary'); + +ALTER TABLE `currencies` ADD `webcart` TINYINT( 1 ) NOT NULL DEFAULT '1' COMMENT 'If 1 shown in weberp cart. if 0 no show'; + +ALTER TABLE `salescat` CHANGE `salescatname` `salescatname` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; +CREATE TABLE `mailgroups` ( id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + groupname varchar(100) NOT NULL, + unique (groupname)) ENGINE = InnoDB DEFAULT CHARSET = utf8; +CREATE TABLE `mailgroupdetails` (groupname varchar(100) NOT NULL, + userid varchar(20) NOT NULL, + CONSTRAINT FOREIGN KEY (`groupname`) REFERENCES `mailgroups` (`groupname`), + CONSTRAINT FOREIGN KEY (`userid`) REFERENCES `www_users`(`userid`), + INDEX(`groupname`)) Engine=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO scripts VALUES('MailingGroupMaintenance.php', 15, 'Mainting mailing lists for items to mail'); + +INSERT INTO mailgroups VALUES(1,'ChkListingRecipients'); +INSERT INTO mailgroups VALUES(2,'SalesAnalysisReportRecipients'); +INSERT INTO scripts VALUES('MailSalesReport_csv.php',15,'Mailing the sales report'); +INSERT INTO mailgroups VALUES(3,'OffersReceivedResultRecipients'); +INSERT INTO mailgroups VALUES(4,'InventoryValuationRecipients'); +ALTER TABLE stockrequestitems DROP PRIMARY KEY; +ALTER TABLE stockrequestitems ADD PRIMARY KEY (`dispatchitemsid`,`dispatchid`); +INSERT INTO scripts VALUES('Z_ImportGLTransactions.php', 15, 'Import General Ledger Transactions'); +CREATE TABLE IF NOT EXISTS `fixedassettasks` ( + `taskid` int(11) NOT NULL AUTO_INCREMENT, + `assetid` int(11) NOT NULL, + `taskdescription` text NOT NULL, + `frequencydays` int(11) NOT NULL DEFAULT '365', + `lastcompleted` date NOT NULL, + `userresponsible` varchar(20) NOT NULL, + `manager` varchar(20) NOT NULL DEFAULT '', + PRIMARY KEY (`taskid`), + KEY `assetid` (`assetid`), + KEY `userresponsible` (`userresponsible`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('MaintenanceTasks.php', '1', 'Allows set up and edit of scheduled maintenance tasks'); +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('MaintenanceUserSchedule.php', '1', 'List users or managers scheduled maintenance tasks and allow to be flagged as completed'); +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('MaintenanceReminders.php', '1', 'Sends email reminders for scheduled asset maintenance tasks'); +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('ImportBankTransAnalysis.php', '11', 'Allows analysis of bank transactions being imported'); +INSERT INTO `scripts` (`script`, `pagesecurity`, `description`) VALUES ('ImportBankTrans.php', '11', 'Imports bank transactions'); +INSERT INTO scripts VALUES ('Manufacturers.php','15','Maintain brands of sales products'); +INSERT INTO scripts VALUES ('SalesCategoryDescriptions.php','15','Maintain translations for sales categories'); +INSERT INTO scripts VALUES ('ShopParameters.php','15','Maintain web-store configuration and set up'); + +INSERT INTO config VALUES ('ShopName',''); +INSERT INTO config VALUES ('ShopPrivacyStatement',''); +INSERT INTO config VALUES ('ShopFreightPolicy',''); +INSERT INTO config VALUES ('ShopTermsConditions',''); +INSERT INTO config VALUES ('ShopDebtorNo',''); +INSERT INTO config VALUES ('ShopBranchCode',''); +INSERT INTO config VALUES ('ShopAboutUs',''); + +INSERT INTO config VALUES ('ShopPayPalUser',''); +INSERT INTO config VALUES ('ShopPayPalPassword',''); +INSERT INTO config VALUES ('ShopPayPalSignature',''); + +INSERT INTO config VALUES ('ShopPayPalProUser',''); +INSERT INTO config VALUES ('ShopPayPalProPassword',''); +INSERT INTO config VALUES ('ShopPayPalProSignature',''); + +INSERT INTO config VALUES ('ShopCreditCardGateway', 'PayFlowPro'); + +INSERT INTO config VALUES ('ShopPayFlowUser',''); +INSERT INTO config VALUES ('ShopPayFlowPassword',''); +INSERT INTO config VALUES ('ShopPayFlowVendor',''); + +INSERT INTO config VALUES ('ShopAllowPayPal', '1'); +INSERT INTO config VALUES ('ShopAllowCreditCards', '1'); +INSERT INTO config VALUES ('ShopAllowBankTransfer', '1'); +INSERT INTO config VALUES ('ShopAllowSurcharges', '1'); + +INSERT INTO config VALUES ('ShopPayPalSurcharge', '0.034'); +INSERT INTO config VALUES ('ShopBankTransferSurcharge', '0.0'); +INSERT INTO config VALUES ('ShopCreditCardSurcharge', '0.029'); + +INSERT INTO config VALUES ('ShopPayPalBankAccount', '1030'); +INSERT INTO config VALUES ('ShopCreditCardBankAccount', '1030'); + +INSERT INTO config VALUES ('ShopSwipeHQMerchantID', ''); +INSERT INTO config VALUES ('ShopSwipeHQAPIKey', ''); + +INSERT INTO config VALUES ('ShopSurchargeStockID', ''); + +INSERT INTO config VALUES ('ItemDescriptionLanguages',''); +INSERT INTO config VALUES('SmtpSetting',0); + +CREATE TABLE IF NOT EXISTS `stockdescriptiontranslations` ( + `stockid` varchar(20) NOT NULL DEFAULT '', + `language_id` varchar(10) NOT NULL DEFAULT 'en_GB.utf8', + `descriptiontranslation` varchar(50) NOT NULL, + PRIMARY KEY (`stockid`,`language_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `debtorsmaster` ADD `language_id` VARCHAR( 10 ) NOT NULL DEFAULT 'en_GB.utf8'; + +ALTER TABLE `debtortrans` ADD `salesperson` VARCHAR( 4 ) NOT NULL DEFAULT '' , ADD INDEX ( `salesperson` ); +UPDATE debtortrans INNER JOIN salesorders ON debtortrans.order_=salesorders.orderno SET debtortrans.salesperson=salesorders.salesperson; +UPDATE debtortrans INNER JOIN custbranch ON debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode SET debtortrans.salesperson=custbranch.salesman WHERE debtortrans.type=11; + +CREATE TABLE IF NOT EXISTS `manufacturers` ( + `manufacturers_id` int(11) NOT NULL AUTO_INCREMENT, + `manufacturers_name` varchar(32) NOT NULL, + `manufacturers_url` varchar(50) NOT NULL DEFAULT '', + `manufacturers_image` varchar(64) DEFAULT NULL, + PRIMARY KEY (`manufacturers_id`), + KEY (`manufacturers_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `salescattranslations` ( + `salescatid` tinyint(4) NOT NULL DEFAULT '0', + `language_id` varchar(10) NOT NULL DEFAULT 'en_GB.utf8', + `salescattranslation` varchar(40) NOT NULL, + PRIMARY KEY (`salescatid`,`language_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE salescatprod ADD COLUMN manufacturers_id int(11) NOT NULL; +ALTER TABLE salescatprod ADD COLUMN featured int(11) DEFAULT '0' NOT NULL; +ALTER TABLE `salescatprod` ADD INDEX ( `manufacturers_id` ); + + +INSERT INTO config VALUES ('ShopMode','test'); +INSERT INTO config VALUES ('ShopContactUs',''); + +UPDATE config SET confvalue='4.11.0' WHERE confname='VersionNumber'; + |