|
91 | 91 | } |
92 | 92 | } |
93 | 93 |
|
94 | | - $SQL = "UPDATE manufacturers SET manufacturers_name='" . $_POST['BrandsName'] . "', |
95 | | - manufacturers_url='" . $_POST['BrandsURL'] . "'"; |
| 94 | + $SQL = "UPDATE brands SET brands_name='" . $_POST['BrandsName'] . "', |
| 95 | + brands_url='" . $_POST['BrandsURL'] . "'"; |
96 | 96 | if (isset($_POST['BrandsImage'])){ |
97 | | - $SQL .= ", manufacturers_image='" . $_POST['BrandsImage'] . "'"; |
| 97 | + $SQL .= ", brands_image='" . $_POST['BrandsImage'] . "'"; |
98 | 98 | } |
99 | | - $SQL .= " WHERE manufacturers_id = '" . $SelectedBrand . "'"; |
| 99 | + $SQL .= " WHERE brands_id = '" . $SelectedBrand . "'"; |
100 | 100 |
|
101 | 101 | $ErrMsg = __('An error occurred updating the') . ' ' . $SelectedBrand . ' ' . __('brand record because'); |
102 | 102 |
|
|
112 | 112 |
|
113 | 113 | /*SelectedBrand 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 */ |
114 | 114 |
|
115 | | - $SQL = "INSERT INTO manufacturers (manufacturers_name, |
116 | | - manufacturers_url) |
| 115 | + $SQL = "INSERT INTO brands (brands_name, |
| 116 | + brands_url) |
117 | 117 | VALUES ('" . $_POST['BrandsName'] . "', |
118 | 118 | '" . $_POST['BrandsURL'] . "')"; |
119 | 119 |
|
120 | 120 | $ErrMsg = __('An error occurred inserting the new brand record because'); |
121 | 121 | $Result = DB_query($SQL, $ErrMsg); |
122 | | - $LastInsertId = DB_Last_Insert_ID('manufacturers', 'manufacturers_id'); |
| 122 | + $LastInsertId = DB_Last_Insert_ID('brands', 'brands_id'); |
123 | 123 |
|
124 | 124 | if (isset($_FILES['BrandPicture']) AND $_FILES['BrandPicture']['name'] !='') { |
125 | 125 |
|
|
154 | 154 | if ($UploadTheFile=='Yes'){ |
155 | 155 | $Result = move_uploaded_file($_FILES['BrandPicture']['tmp_name'], $FileName); |
156 | 156 | $Message = ($Result)?__('File url') . '<a href="' . $FileName .'">' . $FileName . '</a>' : __('Something is wrong with uploading a file'); |
157 | | - DB_query("UPDATE manufacturers |
158 | | - SET manufacturers_image='" . 'BRAND-' . $LastInsertId . "' |
159 | | - WHERE manufacturers_id = '" . $LastInsertId . "' |
| 157 | + DB_query("UPDATE brands |
| 158 | + SET brands_image='" . 'BRAND-' . $LastInsertId . "' |
| 159 | + WHERE brands_id = '" . $LastInsertId . "' |
160 | 160 | "); |
161 | 161 | } |
162 | 162 | } |
|
175 | 175 | $CancelDelete = false; |
176 | 176 |
|
177 | 177 | // PREVENT DELETES IF DEPENDENT RECORDS |
178 | | - $SQL= "SELECT COUNT(*) FROM salescatprod WHERE manufacturers_id='". $SelectedBrand . "'"; |
| 178 | + $SQL= "SELECT COUNT(*) FROM salescatprod WHERE brands_id='". $SelectedBrand . "'"; |
179 | 179 | $Result = DB_query($SQL); |
180 | 180 | $MyRow = DB_fetch_row($Result); |
181 | 181 | if ($MyRow[0]>0) { |
|
186 | 186 |
|
187 | 187 | if (!$CancelDelete) { |
188 | 188 |
|
189 | | - $Result = DB_query("DELETE FROM manufacturers WHERE manufacturers_id='" . $SelectedBrand . "'"); |
| 189 | + $Result = DB_query("DELETE FROM brands WHERE brands_id='" . $SelectedBrand . "'"); |
190 | 190 | foreach ($SupportedImgExt as $Ext) { |
191 | 191 | $File = $_SESSION['part_pics_dir'] . '/BRAND-' . $SelectedBrand . '.' . $Ext; |
192 | 192 | if (file_exists ($File) ) { |
|
207 | 207 | links to delete or edit each. These will call the same page again and allow update/input |
208 | 208 | or deletion of the records*/ |
209 | 209 |
|
210 | | - $SQL = "SELECT manufacturers_id, |
211 | | - manufacturers_name, |
212 | | - manufacturers_url, |
213 | | - manufacturers_image |
214 | | - FROM manufacturers"; |
| 210 | + $SQL = "SELECT brands_id, |
| 211 | + brands_name, |
| 212 | + brands_url, |
| 213 | + brands_image |
| 214 | + FROM brands"; |
215 | 215 | $Result = DB_query($SQL); |
216 | 216 |
|
217 | 217 | if (DB_num_rows($Result)==0){ |
|
230 | 230 | </tr>'; |
231 | 231 |
|
232 | 232 | while ($MyRow = DB_fetch_array($Result)) { |
233 | | - $Glob = (glob($_SESSION['part_pics_dir'] . '/BRAND-' . $MyRow['manufacturers_id'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE)); |
| 233 | + $Glob = (glob($_SESSION['part_pics_dir'] . '/BRAND-' . $MyRow['brands_id'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE)); |
234 | 234 | $ImageFile = reset($Glob); |
235 | | - $BrandImgLink = GetImageLink($ImageFile, '/BRAND-' . $MyRow['manufacturers_id'], 120, 120, "", ""); |
| 235 | + $BrandImgLink = GetImageLink($ImageFile, '/BRAND-' . $MyRow['brands_id'], 120, 120, "", ""); |
236 | 236 |
|
237 | 237 | echo '<tr class="striped_row"> |
238 | | - <td>', $MyRow['manufacturers_id'], '</td> |
239 | | - <td>', $MyRow['manufacturers_name'], '</td> |
240 | | - <td><a target="_blank" href="', $MyRow['manufacturers_url'], '">', $MyRow['manufacturers_url'], '</a></td> |
| 238 | + <td>', $MyRow['brands_id'], '</td> |
| 239 | + <td>', $MyRow['brands_name'], '</td> |
| 240 | + <td><a target="_blank" href="', $MyRow['brands_url'], '">', $MyRow['brands_url'], '</a></td> |
241 | 241 | <td>', $BrandImgLink, '</td> |
242 | | - <td><a href="', htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedBrand=', $MyRow['manufacturers_id'], '&edit=1">' . __('Edit') . '</a></td> |
243 | | - <td><a href="', htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedBrand=', $MyRow['manufacturers_id'], '&delete=1" onclick="return confirm(\'' . __('Are you sure you wish to delete this brand?') . '\');">' . __('Delete') . '</a></td> |
| 242 | + <td><a href="', htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedBrand=', $MyRow['brands_id'], '&edit=1">' . __('Edit') . '</a></td> |
| 243 | + <td><a href="', htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedBrand=', $MyRow['brands_id'], '&delete=1" onclick="return confirm(\'' . __('Are you sure you wish to delete this brand?') . '\');">' . __('Delete') . '</a></td> |
244 | 244 | </tr>'; |
245 | 245 |
|
246 | 246 | } |
|
264 | 264 | echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" Title="' . |
265 | 265 | __('Brand') . '" alt="" />' . ' ' . $Title . '</p>'; |
266 | 266 |
|
267 | | - $SQL = "SELECT manufacturers_id, |
268 | | - manufacturers_name, |
269 | | - manufacturers_url, |
270 | | - manufacturers_image |
271 | | - FROM manufacturers |
272 | | - WHERE manufacturers_id='" . $SelectedBrand . "'"; |
| 267 | + $SQL = "SELECT brands_id, |
| 268 | + brands_name, |
| 269 | + brands_url, |
| 270 | + brands_image |
| 271 | + FROM brands |
| 272 | + WHERE brands_id='" . $SelectedBrand . "'"; |
273 | 273 |
|
274 | 274 | $Result = DB_query($SQL); |
275 | 275 | $MyRow = DB_fetch_array($Result); |
276 | 276 |
|
277 | | - $_POST['BrandsName'] = $MyRow['manufacturers_name']; |
278 | | - $_POST['BrandsURL'] = $MyRow['manufacturers_url']; |
279 | | - $_POST['BrandsImage'] = $MyRow['manufacturers_image']; |
| 277 | + $_POST['BrandsName'] = $MyRow['brands_name']; |
| 278 | + $_POST['BrandsURL'] = $MyRow['brands_url']; |
| 279 | + $_POST['BrandsImage'] = $MyRow['brands_image']; |
280 | 280 |
|
281 | 281 |
|
282 | 282 | echo '<input type="hidden" name="SelectedBrand" value="' . $SelectedBrand . '" />'; |
|
0 commit comments