fixing some database issues

This commit is contained in:
Development 2020-09-25 14:22:51 +02:00
commit 36218b9594
3 changed files with 28 additions and 22 deletions

View file

@ -13,7 +13,7 @@ if (UserHasRight('EditVendors'))
$Homepage = (isset($_POST['Homepage']))? $_POST['Homepage']:"";
$MinBill = (isset($_POST['MinBill']))? OtherConvertToFloat($_POST['MinBill']):0;
$ShippingCost = (isset($_POST['ShippingCost']))? OtherConvertToFloat($_POST['ShippingCost']):0;
if (LockIsActive('Vendors',$_POST['Id']))
{
MessageError(LangSpellHtml('SentenceLockIsActive'));
@ -66,7 +66,7 @@ if (UserHasRight('EditVendors'))
{
MessageError(LangSpellHtml('SentenceLockIsActive'));
}
}
//////////////
@ -77,7 +77,7 @@ if (UserHasRight('EditVendors'))
$Homepage = (isset($_POST['Homepage']))? $_POST['Homepage']:"";
$MinBill = (isset($_POST['MinBill']))? OtherConvertToFloat($_POST['MinBill']):0;
$ShippingCost = (isset($_POST['ShippingCost']))? OtherConvertToFloat($_POST['ShippingCost']):0;
if (!$Name)
{
$Error=1;
@ -85,19 +85,19 @@ if (UserHasRight('EditVendors'))
}
else
{
$InsertVendorQuery = "INSERT INTO `Vendors` ( `Name` , `Homepage` , `MinBill` , `ShippingCost` ) VALUES ( '$Name', '$Homepage', '$MinBill', '$ShippingCost' );";
if (!mysqli_query($GlobalMysqlHandler, $InsertVendorQuery))
{
ErrorLog("[edit_vendors.php] Database error while insert new vendor!");
$InsertVendorQuery = "INSERT INTO `Vendors` (`Name`, `Homepage`, `MinBill`, `ShippingCost`, `LockId`, `LockTime`) VALUES ('$Name', '$Homepage', '$MinBill', '$ShippingCost', 0, 0);";
if (mysqli_query($GlobalMysqlHandler, $InsertVendorQuery) === false) {
$err_msg = "Database error while insert new vendor!";
$err_msg += "\nErrno: " . mysqli_connect_errno();
$err_msg += "\nError: " . mysqli_connect_error();
ErrorLog($err_msg);
MessageError(LangSpell('SentenceDatabaseError'));
}
else
{
} else {
MessageSuccess(LangSpell('EditVendorsSentenceVendorNewAdded'));
}
}
}
//////////////////
//cancel editing
if ($ToDo=="CancelEditVendor")
@ -116,11 +116,11 @@ if (UserHasRight('EditVendors'))
}
if(UserHasRight('EditVendors') || UserHasRight('ViewSTPV'))
{
{
//////////////////
//global content
$GlobalContent.='<table>'."\n";
$GlobalContent.=' <tr>'."\n";
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsId').'</th>'."\n";
$GlobalContent.=' <th>'.LangSpellHtml('EditVendorsName').'</th>'."\n";
@ -130,7 +130,7 @@ if(UserHasRight('EditVendors') || UserHasRight('ViewSTPV'))
if (UserHasRight('EditVendors'))
$GlobalContent.=' <th colspan="2">'.LangSpellHtml('EditVendorsEdit').'</th>'."\n";
$GlobalContent.=' </tr>'."\n";
$VendorQuery = "SELECT * FROM `Vendors`";
$VendorQuery = mysqli_query($GlobalMysqlHandler, $VendorQuery);
while ($Vendor=mysqli_fetch_array($VendorQuery))
@ -189,7 +189,7 @@ if(UserHasRight('EditVendors') || UserHasRight('ViewSTPV'))
$GlobalContent.=' </tr>'."\n";
$GlobalContent.=' </form>'."\n";
}
$GlobalContent.='</table>'."\n";
}
else