|
From: <dai...@us...> - 2014-03-14 22:17:34
|
Revision: 6607
http://sourceforge.net/p/web-erp/reponame/6607
Author: daintree
Date: 2014-03-14 22:17:30 +0000 (Fri, 14 Mar 2014)
Log Message:
-----------
Andrew Galuski Auto Supplier numbering
Modified Paths:
--------------
trunk/Suppliers.php
trunk/SystemParameters.php
trunk/doc/Change.log
trunk/sql/mysql/upgrade4.11-4.12.sql
Modified: trunk/Suppliers.php
===================================================================
--- trunk/Suppliers.php 2014-03-14 20:30:35 UTC (rev 6606)
+++ trunk/Suppliers.php 2014-03-14 22:17:30 UTC (rev 6607)
@@ -305,8 +305,8 @@
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Suppliers') . '</p>';
if (isset($SupplierID)) {
echo '<p>
- <a href="' . $RootPath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Supplier Contact Details') . '</a>
- </p>';
+ <a href="' . $RootPath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Supplier Contact Details') . '</a>
+ </p>';
}
$InputError = 0;
@@ -340,7 +340,7 @@
$Errors[$i]='Name';
$i++;
}
- if (mb_strlen($SupplierID) == 0) {
+ if ($_SESSION['AutoSupplierNo']==0 AND mb_strlen($SupplierID) == 0) {
$InputError = 1;
prnMsg(_('The Supplier Code cannot be empty'),'error');
$Errors[$i]='ID';
@@ -532,7 +532,10 @@
prnMsg(_('The supplier master record for') . ' ' . $SupplierID . ' ' . _('has been updated'),'success');
} else { //its a new supplier
-
+ if ($_SESSION['AutoSupplierNo']== 1) {
+ /* system assigned, sequential, numeric */
+ $SupplierID = GetNextTransNo(600, $db);
+ }
$sql = "INSERT INTO suppliers (supplierid,
suppname,
address1,
@@ -591,7 +594,11 @@
prnMsg(_('A new supplier for') . ' ' . $_POST['SuppName'] . ' ' . _('has been added to the database'),'success');
- unset($SupplierID);
+ echo '<p>
+ <a href="' . $RootPath . '/SupplierContacts.php?SupplierID=' . $SupplierID . '">' . _('Review Supplier Contact Details') . '</a>
+ </p>';
+
+ unset($SupplierID);
unset($_POST['SuppName']);
unset($_POST['Address1']);
unset($_POST['Address2']);
@@ -681,9 +688,13 @@
echo '<input type="hidden" name="New" value="Yes" />';
echo '<table class="selection">';
- echo '<tr><td>' . _('Supplier Code') . ':</td>
- <td><input type="text" data-type="no-illegal-chars" title="'._('The supplier id should not be within 10 legal characters and cannot be blank').'" required="required" name="SupplierID" placeholder="'._('within 10 characters').'" size="11" maxlength="10" /></td>
- </tr>';
+
+ /* if $AutoSupplierNo is off (not 0) then provide an input box for the SupplierID to manually assigned */
+ if ($_SESSION['AutoSupplierNo']== 0 ) {
+ echo '<tr><td>' . _('Supplier Code') . ':</td>
+ <td><input type="text" data-type="no-illegal-chars" title="'._('The supplier id should not be within 10 legal characters and cannot be blank').'" required="required" name="SupplierID" placeholder="'._('within 10 characters').'" size="11" maxlength="10" /></td>
+ </tr>';
+ }
echo '<tr>
<td>' . _('Supplier Name') . ':</td>
<td><input type="text" pattern="(?!^\s+$)[^<>+]{1,40}" required="required" title="'._('The supplier name should not be blank and should be less than 40 legal characters').'" name="SuppName" size="42" placeholder="'._('Within 40 legal characters').'" maxlength="40" /></td>
@@ -849,8 +860,9 @@
<div class="centre"><input type="submit" name="submit" value="' . _('Insert New Supplier') . '" /></div>';
echo '</div>
</form>';
+}
-} else {
+else {
//SupplierID exists - either passed when calling the form or from the form itself
@@ -916,27 +928,43 @@
} else {
// its a new supplier being added
+
echo '<tr><td><input type="hidden" name="New" value="Yes" />';
- echo _('Supplier Code') . ':</td>
- <td><input '.(in_array('ID',$Errors) ? 'class="inputerror"' : '').' type="text" name="SupplierID" value="' . $SupplierID . '" size="12" maxlength="10" /></td></tr>';
+ /* if $AutoSupplierNo is off (i.e. 0) then provide an input box for the SupplierID to manually assigned */
+ if ($_SESSION['AutoSupplierNo']== 0 ) {
+ echo _('Supplier Code') . ':</td>
+ <td><input '.(in_array('ID',$Errors) ? 'class="inputerror"' : '').' type="text" name="SupplierID" value="' . $SupplierID . '" size="12" maxlength="10" /></td></tr>';
+ }
}
- echo '<tr><td>' . _('Supplier Name') . ':</td>
- <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="SuppName" value="' . $_POST['SuppName'] . '" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td>
- <td><input type="text" name="Address1" value="' . $_POST['Address1'] . '" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Address Line 2 (Street)') . ':</td>
- <td><input type="text" name="Address2" value="' . $_POST['Address2'] . '" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Address Line 3 (Suburb/City)') . ':</td>
- <td><input type="text" name="Address3" placeholder="'._('Within 40 characters').'" value="' . $_POST['Address3'] . '" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Address Line 4 (State/Province)') . ':</td>
- <td><input type="text" name="Address4" value="' . $_POST['Address4'] . '" placeholder="'._('Within 40 characters').'" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Address Line 5 (Postal Code)') . ':</td>
- <td><input type="text" name="Address5" value="' . $_POST['Address5'] . '" size="42" placeholder="'._('Witin 40 characters').'" maxlength="40" /></td></tr>';
-
echo '<tr>
+ <td>' . _('Supplier Name') . ':</td>
+ <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="text" name="SuppName" value="' . $_POST['SuppName'] . '" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 1 (Street)') . ':</td>
+ <td><input type="text" name="Address1" value="' . $_POST['Address1'] . '" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 2 (Street)') . ':</td>
+ <td><input type="text" name="Address2" value="' . $_POST['Address2'] . '" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 3 (Suburb/City)') . ':</td>
+ <td><input type="text" name="Address3" placeholder="'._('Within 40 characters').'" value="' . $_POST['Address3'] . '" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 4 (State/Province)') . ':</td>
+ <td><input type="text" name="Address4" value="' . $_POST['Address4'] . '" placeholder="'._('Within 40 characters').'" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Address Line 5 (Postal Code)') . ':</td>
+ <td><input type="text" name="Address5" value="' . $_POST['Address5'] . '" size="42" placeholder="'._('Witin 40 characters').'" maxlength="40" /></td>
+ </tr>
+ <tr>
<td>' . _('Country') . ':</td>
<td><select name="Address6">';
+
foreach ($CountriesArray as $CountryEntry => $CountryName){
if (isset($_POST['Address6']) AND ($_POST['Address6'] == $CountryName)){
echo '<option selected="selected" value="' . $CountryName . '">' . $CountryName . '</option>';
@@ -949,15 +977,24 @@
echo '</select></td>
</tr>';
- echo '<tr><td>' . _('Telephone') . ':</td>
- <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="tel" pattern="[\s\d+()-]{1,40}" placeholder="'._('Only digit blank ( ) and - allowed').'" name="Phone" value="' . $_POST['Phone'] . '" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Facsimile') . ':</td>
- <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="tel" pattern="[\s\d+()-]{1,40}" placeholder="'._('Only digit blank ( ) and - allowed').'" name="Fax" value="' . $_POST['Fax'] . '" size="42" maxlength="40" /></td></tr>';
- echo '<tr><td>' . _('Email Address') . ':</td>
- <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="email" title="'._('The input must be in email format').'" name="Email" value="' . $_POST['Email'] . '" size="42" maxlength="40" placeholder="'._('email format such as xx...@ma...').'" pattern="[a-z0-9!#$%&\'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*" /></td></tr>';
- echo '<tr><td>' . _('URL') . ':</td>
- <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="url" title="'._('The input must be in url format').'" name="URL" value="' . $_POST['URL'] . '" size="42" maxlength="40" placeholder="'._('url format such as www.example.com').'" /></td></tr>';
- echo '<tr><td>' . _('Supplier Type') . ':</td>
+ echo '<tr>
+ <td>' . _('Telephone') . ':</td>
+ <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="tel" pattern="[\s\d+()-]{1,40}" placeholder="'._('Only digit blank ( ) and - allowed').'" name="Phone" value="' . $_POST['Phone'] . '" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Facsimile') . ':</td>
+ <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="tel" pattern="[\s\d+()-]{1,40}" placeholder="'._('Only digit blank ( ) and - allowed').'" name="Fax" value="' . $_POST['Fax'] . '" size="42" maxlength="40" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Email Address') . ':</td>
+ <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="email" title="'._('The input must be in email format').'" name="Email" value="' . $_POST['Email'] . '" size="42" maxlength="40" placeholder="'._('email format such as xx...@ma...').'" pattern="[a-z0-9!#$%&\'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*" /></td>
+ </tr>
+ <tr>
+ <td>' . _('URL') . ':</td>
+ <td><input '.(in_array('Name',$Errors) ? 'class="inputerror"' : '').' type="url" title="'._('The input must be in url format').'" name="URL" value="' . $_POST['URL'] . '" size="42" maxlength="40" placeholder="'._('url format such as www.example.com').'" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Supplier Type') . ':</td>
<td><select name="SupplierType">';
$result=DB_query("SELECT typeid, typename FROM suppliertype", $db);
while ($myrow = DB_fetch_array($result)) {
@@ -967,20 +1004,29 @@
echo '<option value="' . $myrow['typeid'] . '">' . $myrow['typename'] . '</option>';
}
} //end while loop
- echo '</select></td></tr>';
+ echo '</select></td>
+ </tr>
+ <tr>
+ <td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] .'):</td>
+ <td><input '.(in_array('SupplierSince',$Errors) ? 'class="inputerror"' : '').' size="12" maxlength="10" type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="SupplierSince" value="' . $_POST['SupplierSince'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Bank Particulars') . ':</td>
+ <td><input type="text" name="BankPartics" size="13" maxlength="12" value="' . $_POST['BankPartics'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Bank Reference') . ':</td>
+ <td><input '.(in_array('BankRef',$Errors) ? 'class="inputerror"' : '').' type="text" name="BankRef" size="13" maxlength="12" value="' . $_POST['BankRef'] . '" /></td>
+ </tr>
+ <tr>
+ <td>' . _('Bank Account No') . ':</td>
+ <td><input type="text" name="BankAct" size="31" maxlength="30" value="' . $_POST['BankAct'] . '" /></td>
+ </tr>';
- echo '<tr><td>' . _('Supplier Since') . ' (' . $_SESSION['DefaultDateFormat'] .'):</td>
- <td><input '.(in_array('SupplierSince',$Errors) ? 'class="inputerror"' : '').' size="12" maxlength="10" type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="SupplierSince" value="' . $_POST['SupplierSince'] . '" /></td></tr>';
- echo '<tr><td>' . _('Bank Particulars') . ':</td>
- <td><input type="text" name="BankPartics" size="13" maxlength="12" value="' . $_POST['BankPartics'] . '" /></td></tr>';
- echo '<tr><td>' . _('Bank Reference') . ':</td>
- <td><input '.(in_array('BankRef',$Errors) ? 'class="inputerror"' : '').' type="text" name="BankRef" size="13" maxlength="12" value="' . $_POST['BankRef'] . '" /></td></tr>';
- echo '<tr><td>' . _('Bank Account No') . ':</td>
- <td><input type="text" name="BankAct" size="31" maxlength="30" value="' . $_POST['BankAct'] . '" /></td></tr>';
-
$result=DB_query("SELECT terms, termsindicator FROM paymentterms", $db);
- echo '<tr><td>' . _('Payment Terms') . ':</td>
+ echo '<tr>
+ <td>' . _('Payment Terms') . ':</td>
<td><select name="PaymentTerms">';
while ($myrow = DB_fetch_array($result)) {
@@ -995,7 +1041,8 @@
$result=DB_query("SELECT id, coyname FROM factorcompanies", $db);
- echo '<tr><td>' . _('Factor Company') . ':</td>
+ echo '<tr>
+ <td>' . _('Factor Company') . ':</td>
<td><select name="FactorID">';
echo '<option value="0">' . _('None') . '</option>';
while ($myrow = DB_fetch_array($result)) {
@@ -1007,12 +1054,15 @@
} //end while loop
DB_data_seek($result, 0);
echo '</select></td></tr>';
- echo '<tr><td>' . _('Tax Reference') . ':</td>
- <td><input type="text" name="TaxRef" size="21" maxlength="20" value="' . $_POST['TaxRef'] .'" /></td></tr>';
+ echo '<tr>
+ <td>' . _('Tax Reference') . ':</td>
+ <td><input type="text" name="TaxRef" size="21" maxlength="20" value="' . $_POST['TaxRef'] .'" /></td>
+ </tr>';
$result=DB_query("SELECT currency, currabrev FROM currencies", $db);
- echo '<tr><td>' . _('Supplier Currency') . ':</td>
+ echo '<tr>
+ <td>' . _('Supplier Currency') . ':</td>
<td><select name="CurrCode">';
while ($myrow = DB_fetch_array($result)) {
if ($_POST['CurrCode'] == $myrow['currabrev']){
@@ -1023,8 +1073,10 @@
} //end while loop
DB_data_seek($result, 0);
- echo '</select></td></tr>
- <tr><td>' . _('Remittance Advice') . ':</td>
+ echo '</select></td>
+ </tr>
+ <tr>
+ <td>' . _('Remittance Advice') . ':</td>
<td><select name="Remittance">';
if ($_POST['Remittance'] == 0){
@@ -1036,9 +1088,10 @@
}
- echo '</select></td></tr>';
-
- echo '<tr><td>' . _('Tax Group') . ':</td>
+ echo '</select></td>
+ </tr>
+ <tr>
+ <td>' . _('Tax Group') . ':</td>
<td><select name="TaxGroup">';
DB_data_seek($result, 0);
@@ -1055,7 +1108,9 @@
} //end while loop
- echo '</select></td></tr></table>';
+ echo '</select></td>
+ </tr>
+ </table>';
if (isset($_POST['New'])) {
echo '<br />
Modified: trunk/SystemParameters.php
===================================================================
--- trunk/SystemParameters.php 2014-03-14 20:30:35 UTC (rev 6606)
+++ trunk/SystemParameters.php 2014-03-14 22:17:30 UTC (rev 6607)
@@ -216,6 +216,9 @@
if ($_SESSION['AutoDebtorNo'] != $_POST['X_AutoDebtorNo'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_AutoDebtorNo'])."' WHERE confname = 'AutoDebtorNo'";
}
+ if ($_SESSION['AutoSupplierNo'] != $_POST['X_AutoSupplierNo'] ) {
+ $sql[] = "UPDATE config SET confvalue = '". ($_POST['X_AutoSupplierNo'])."' WHERE confname = 'AutoSupplierNo'";
+ }
if ($_SESSION['HTTPS_Only'] != $_POST['X_HTTPS_Only'] ) {
$sql[] = "UPDATE config SET confvalue = '". ($_POST['X_HTTPS_Only'])."' WHERE confname = 'HTTPS_Only'";
}
@@ -397,12 +400,12 @@
// PastDueDays1
echo '<tr style="outline: 1px solid"><td>' . _('First Overdue Deadline in (days)') . ':</td>
- <td><input type="text" class="integer" required="required" pattern="(?!^0\d+$)[-\d]+" title="'._('The input must be integer').'" name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size="3" maxlength="3" /></td>
+ <td><input type="text" class="integer" required="required" pattern="(?!^0\d+$)[\d]+" title="'._('The input must be integer').'" name="X_PastDueDays1" value="' . $_SESSION['PastDueDays1'] . '" size="3" maxlength="3" /></td>
<td>' . _('Customer and supplier balances are displayed as overdue by this many days. This parameter is used on customer and supplier enquiry screens and aged listings') . '</td></tr>';
// PastDueDays2
echo '<tr style="outline: 1px solid"><td>' . _('Second Overdue Deadline in (days)') . ':</td>
- <td><input type="text" class="integer" required="required" pattern="(?!^0\d+$)[-\d]+" title="'._('The input must be integer').'" name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size="3" maxlength="3" /></td>
+ <td><input type="text" class="integer" required="required" pattern="(?!^0\d+$)[\d]+" title="'._('The input must be integer').'" name="X_PastDueDays2" value="' . $_SESSION['PastDueDays2'] . '" size="3" maxlength="3" /></td>
<td>' . _('As above but the next level of overdue') . '</td></tr>';
@@ -626,6 +629,21 @@
echo '</select></td>
<td>' . _('Set to Automatic - customer codes are automatically created - as a sequential number') . '</td></tr>';
+echo '<tr style="outline: 1px solid"><td>' . _('Create Supplier Codes Automatically') . ':</td>
+ <td><select name="X_AutoSupplierNo">';
+
+if ($_SESSION['AutoSupplierNo']==0) {
+ echo '<option selected="selected" value="0">' . _('Manual Entry') . '</option>';
+ echo '<option value="1">' . _('Automatic') . '</option>';
+} else {
+ echo '<option selected="selected" value="1">' . _('Automatic') . '</option>';
+ echo '<option value="0">' . _('Manual Entry') . '</option>';
+}
+echo '</select></td>
+ <td>' . _('Set to Automatic - Supplier codes are automatically created - as a sequential number') . '</td></tr>';
+
+
+
//==HJ== drop down list for tax category
$sql = "SELECT taxcatid, taxcatname FROM taxcategories ORDER BY taxcatname";
$ErrMsg = _('Could not load tax categories table');
@@ -1070,9 +1088,9 @@
//DefineControlledOnWOEntry
echo '<tr style="outline: 1px solid"><td>' . _('Controlled Items Defined At Work Order Entry') . ':</td>
<td><select name="X_DefineControlledOnWOEntry">
- <option '.($_SESSION['DefineControlledOnWOEntry']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
- <option '.(!$_SESSION['DefineControlledOnWOEntry']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
- </select></td>
+ <option '.($_SESSION['DefineControlledOnWOEntry']?'selected="selected" ':'').'value="1">' . _('Yes') . '</option>
+ <option '.(!$_SESSION['DefineControlledOnWOEntry']?'selected="selected" ':'').'value="0">' . _('No') . '</option>
+ </select></td>
<td>' . _('When set to yes, controlled items are defined at the time of the work order creation. Otherwise controlled items (serial numbers and batch/roll/lot references) are entered at the time the finished items are received against the work order') . '</td></tr>';
//AutoCreateWOs
@@ -1143,4 +1161,4 @@
</form>';
include('includes/footer.inc');
-?>
\ No newline at end of file
+?>
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2014-03-14 20:30:35 UTC (rev 6606)
+++ trunk/doc/Change.log 2014-03-14 22:17:30 UTC (rev 6607)
@@ -1,5 +1,6 @@
webERP Change Log
+15/3/14 Andrew Galuski: Auto Supplier number functionality
14/3/14 Jiro Akits: Updated zh_TW.utf8 translation
14/3/14 phil: removed htmchars in DB_escape_string() functions as suggested by Tim
05/03/14 icedlava: Ensure there are no unescaped characters in existing data when updating purchorders after reversing GRN. This fixes a symptom of a more widespread bug and therefore temporary until more general fix is applied.
Modified: trunk/sql/mysql/upgrade4.11-4.12.sql
===================================================================
--- trunk/sql/mysql/upgrade4.11-4.12.sql 2014-03-14 20:30:35 UTC (rev 6606)
+++ trunk/sql/mysql/upgrade4.11-4.12.sql 2014-03-14 22:17:30 UTC (rev 6607)
@@ -1,3 +1,3 @@
-
+INSERT INTO `weberpdemo`.`systypes` (`typeid` ,`typename` ,`typeno`) VALUES ('600', 'Auto Supplier Number', '0');
UPDATE config SET confvalue='4.12' WHERE confname='VersionNumber';
|