[AppDB] Fix up maintaining vendors.
Tony Lambregts
tony_lambregts at telusplanet.net
Sat Jan 1 16:22:53 CST 2005
We should not be able to delete Vendors that have apps attached to them. I also
fixed up editing of vendors.
Change Log: Fix up editing of vendors
Files changed: admin/editVendor.php admin/adminVendors.php
-------------- next part --------------
Index: admin/adminVendors.php
===================================================================
RCS file: /home/wine/appdb/admin/adminVendors.php,v
retrieving revision 1.2
diff -u -r1.2 adminVendors.php
--- admin/adminVendors.php 29 Dec 2004 20:21:32 -0000 1.2
+++ admin/adminVendors.php 1 Jan 2005 22:17:19 -0000
@@ -22,14 +22,25 @@
{
if($_REQUEST['sub'] == 'delete')
{
- $sQuery = "DELETE FROM vendor WHERE vendorId = ".$_REQUEST['vendorId'].";";
- echo "$sQuery";
+ $sQuery = "SELECT * FROM appFamily WHERE vendorId = ".$_REQUEST['vendorId'].";";
+ if (debugging()) echo "$sQuery";
$hResult = query_appdb($sQuery);
- echo html_frame_start("Delete vendor: ".$_REQUEST['vendorId'],400,"",0);
- if($hResult)
+
+
+ if(!$hResult || !mysql_num_rows($hResult))
+ {
+ $sQuery = "DELETE FROM vendor WHERE vendorId = ".$_REQUEST['vendorId'].";";
+ if (debugging()) echo "$sQuery";
+ $hResult = query_appdb($sQuery);
+ echo html_frame_start("Delete vendor: ".$_REQUEST['vendorId'],400,"",0);
+ if($hResult)
+ {
+ //success
+ echo "<p>Vendor was successfully deleted</p>\n";
+ }
+ } else
{
- //success
- echo "<p>Vendor was successfully deleted</p>\n";
+ echo "<p><b> Error: Can not delete a vendor with applications attached to it!</b></p>\n";
}
echo html_frame_end(" ");
echo html_back_link(1,'adminVendors.php');
@@ -64,7 +75,7 @@
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
- echo " <td>".$ob->vendorName."</td>\n";
+ echo " <td><a href=".BASE."vendorview.php?vendorId=".$ob->vendorId.">".$ob->vendorName."</a></td>\n";
echo " <td><a href=\"".$ob->vendorURL."\">".$ob->vendorURL."</a></td>\n";
echo " <td>[<a href='adminVendors.php?sub=delete&vendorId=$ob->vendorId'>delete</a>]</td>\n";
echo "</tr>\n\n";
Index: admin/editVendor.php
===================================================================
RCS file: /home/wine/appdb/admin/editVendor.php,v
retrieving revision 1.4
diff -u -r1.4 editVendor.php
--- admin/editVendor.php 29 Dec 2004 20:21:32 -0000 1.4
+++ admin/editVendor.php 1 Jan 2005 22:17:19 -0000
@@ -16,6 +16,7 @@
$admin_mode = 1;
}
+$vendorId = $_REQUEST['vendorId'];
apidb_header("Edit Vendor Information");
$t = new TableVE("edit");
More information about the wine-patches
mailing list