Commit be1609eda153907cf7321e98f30cc5e631f201bc

Authored by Alex Savenko
1 parent 8583a5ba

status

src/app/backend/controllers/DiscountController.php
... ... @@ -224,12 +224,12 @@ class DiscountController extends Controller
224 224  
225 225 if ($status == 1) {
226 226  
227   - $this->models->getDiscount()->updateData(['status' => 0], $id);
  227 + $this->models->getDiscount()->updateStatus('0', $id);
228 228  
229 229 }
230 230 elseif ($status == 0) {
231 231  
232   - $this->models->getDiscount()->updateData(['status' => 1], $id);
  232 + $this->models->getDiscount()->updateStatus('1', $id);
233 233  
234 234 }
235 235  
... ...
src/lib/models/discount.php
... ... @@ -198,6 +198,32 @@ class discount extends \db
198 198 'id' => $id
199 199 ]
200 200 );
  201 +
  202 + }
  203 +
  204 + /**
  205 + * Switch status indicator
  206 + * @param bool $status
  207 + * @param $id
  208 + * @return bool
  209 + */
  210 + public function updateStatus($status, $id) {
  211 +
  212 + return $this->exec(
  213 + '
  214 + UPDATE
  215 + public.discount
  216 + SET
  217 + status = :status
  218 + WHERE
  219 + id = :id
  220 + ',
  221 + [
  222 + 'status' => $status,
  223 + 'id' => $id
  224 + ]
  225 + );
  226 +
201 227 }
202 228  
203 229 /**
... ...