Subversion Repositories SmartDukaan

Rev

Rev 15217 | Rev 15824 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15217 Rev 15227
Line 191... Line 191...
191
		if(!empty($response['data'])){
191
		if(!empty($response['data'])){
192
			$this->set(compact('storemapping','activestores','pendingOrders','approvedOrders','creditedOrders','pendingCashbacks','creditedCashbacks','pendingAmount','approvedAmount','creditedAmount'));
192
			$this->set(compact('storemapping','activestores','pendingOrders','approvedOrders','creditedOrders','pendingCashbacks','creditedCashbacks','pendingAmount','approvedAmount','creditedAmount'));
193
		}
193
		}
194
	}
194
	}
195
 
195
 
196
/**
196
/*
197
 * index method
-
 
198
 *
-
 
199
 * @return void
-
 
200
 */
-
 
201
	public function index() {
197
	public function index() {
202
		throw new NotFoundException(__('Access Denied'));
198
		throw new NotFoundException(__('Access Denied'));
203
		$this->Order->recursive = 0;
199
		$this->Order->recursive = 0;
204
		$this->set('orders', $this->Paginator->paginate());
200
		$this->set('orders', $this->Paginator->paginate());
205
	}
201
	}
206
 
202
 
207
/**
-
 
208
 * view method
-
 
209
 *
203
 
210
 * @throws NotFoundException
-
 
211
 * @param string $id
-
 
212
 * @return void
-
 
213
 */
-
 
214
	public function view($id = null) {
204
	public function view($id = null) {
215
		throw new NotFoundException(__('Access Denied'));
205
		throw new NotFoundException(__('Access Denied'));
216
		if (!$this->Order->exists($id)) {
206
		if (!$this->Order->exists($id)) {
217
			throw new NotFoundException(__('Invalid order'));
207
			throw new NotFoundException(__('Invalid order'));
218
		}
208
		}
219
		$options = array('conditions' => array('Order.' . $this->Order->primaryKey => $id));
209
		$options = array('conditions' => array('Order.' . $this->Order->primaryKey => $id));
220
		$this->set('order', $this->Order->find('first', $options));
210
		$this->set('order', $this->Order->find('first', $options));
221
	}
211
	}
-
 
212
*/
222
 
213
	
223
/**
214
/**
224
 * add method
215
 * add method
225
 *
216
 *
226
 * @return void
217
 * @return void
227
 */
218
 */
Line 311... Line 302...
311
			));
302
			));
312
			$this->render('/Elements/json');		
303
			$this->render('/Elements/json');		
313
		}			
304
		}			
314
	}
305
	}
315
 
306
 
316
/**
307
/*
317
 * edit method
-
 
318
 *
308
 
319
 * @throws NotFoundException
-
 
320
 * @param string $id
-
 
321
 * @return void
-
 
322
 */
-
 
323
	public function edit($id = null) {
309
	public function edit($id = null) {
324
		throw new NotFoundException(__('Access Denied'));
310
		throw new NotFoundException(__('Access Denied'));
325
		if (!$this->Order->exists($id)) {
311
		if (!$this->Order->exists($id)) {
326
			throw new NotFoundException(__('Invalid order'));
312
			throw new NotFoundException(__('Invalid order'));
327
		}
313
		}
Line 340... Line 326...
340
		$stores = $this->Order->Store->find('list');
326
		$stores = $this->Order->Store->find('list');
341
		$storeOrders = $this->Order->StoreOrder->find('list');
327
		$storeOrders = $this->Order->StoreOrder->find('list');
342
		$this->set(compact('users', 'stores', 'storeOrders'));
328
		$this->set(compact('users', 'stores', 'storeOrders'));
343
	}
329
	}
344
 
330
 
345
/**
-
 
346
 * delete method
-
 
347
 *
331
 
348
 * @throws NotFoundException
-
 
349
 * @param string $id
-
 
350
 * @return void
-
 
351
 */
-
 
352
	public function delete($id = null) {
332
	public function delete($id = null) {
353
		throw new NotFoundException(__('Access Denied'));
333
		throw new NotFoundException(__('Access Denied'));
354
		$this->Order->id = $id;
334
		$this->Order->id = $id;
355
		if (!$this->Order->exists()) {
335
		if (!$this->Order->exists()) {
356
			throw new NotFoundException(__('Invalid order'));
336
			throw new NotFoundException(__('Invalid order'));
Line 361... Line 341...
361
		} else {
341
		} else {
362
			$this->Session->setFlash(__('The order could not be deleted. Please, try again.'));
342
			$this->Session->setFlash(__('The order could not be deleted. Please, try again.'));
363
		}
343
		}
364
		return $this->redirect(array('action' => 'index'));
344
		return $this->redirect(array('action' => 'index'));
365
	}
345
	}
-
 
346
*/
366
 
347
 
367
/**
348
/**
368
 * admin_index method
349
 * admin_index method
369
 *
350
 *
370
 * @return void
351
 * @return void
371
 */
352
 */
372
	public function admin_index() {
353
	public function admin_index() {
-
 
354
		$this->checkAcl();
373
		$this->Order->recursive = 0;
355
		$this->Order->recursive = 0;
374
		$this->set('orders', $this->Paginator->paginate());
356
		$this->set('orders', $this->Paginator->paginate());
375
	}
357
	}
376
 
358
 
377
/**
359
/**
Line 380... Line 362...
380
 * @throws NotFoundException
362
 * @throws NotFoundException
381
 * @param string $id
363
 * @param string $id
382
 * @return void
364
 * @return void
383
 */
365
 */
384
	public function admin_view($id = null) {
366
	public function admin_view($id = null) {
-
 
367
		$this->checkAcl();
385
		if (!$this->Order->exists($id)) {
368
		if (!$this->Order->exists($id)) {
386
			throw new NotFoundException(__('Invalid order'));
369
			throw new NotFoundException(__('Invalid order'));
387
		}
370
		}
388
		$options = array('conditions' => array('Order.' . $this->Order->primaryKey => $id));
371
		$options = array('conditions' => array('Order.' . $this->Order->primaryKey => $id));
389
		$this->set('order', $this->Order->find('first', $options));
372
		$this->set('order', $this->Order->find('first', $options));
Line 393... Line 376...
393
 * admin_add method
376
 * admin_add method
394
 *
377
 *
395
 * @return void
378
 * @return void
396
 */
379
 */
397
	public function admin_add() {
380
	public function admin_add() {
-
 
381
		$this->checkAcl();
398
		if ($this->request->is('post')) {
382
		if ($this->request->is('post')) {
399
			$this->Order->create();
383
			$this->Order->create();
400
			if ($this->Order->save($this->request->data)) {
384
			if ($this->Order->save($this->request->data)) {
401
				$this->Session->setFlash(__('The order has been saved.'));
385
				$this->Session->setFlash(__('The order has been saved.'));
402
				return $this->redirect(array('action' => 'index'));
386
				return $this->redirect(array('action' => 'index'));
Line 416... Line 400...
416
 * @throws NotFoundException
400
 * @throws NotFoundException
417
 * @param string $id
401
 * @param string $id
418
 * @return void
402
 * @return void
419
 */
403
 */
420
	public function admin_edit($id = null) {
404
	public function admin_edit($id = null) {
-
 
405
		$this->checkAcl();
421
		if (!$this->Order->exists($id)) {
406
		if (!$this->Order->exists($id)) {
422
			throw new NotFoundException(__('Invalid order'));
407
			throw new NotFoundException(__('Invalid order'));
423
		}
408
		}
424
		if ($this->request->is(array('post', 'put'))) {
409
		if ($this->request->is(array('post', 'put'))) {
425
			if ($this->Order->save($this->request->data)) {
410
			if ($this->Order->save($this->request->data)) {
Line 444... Line 429...
444
 * @throws NotFoundException
429
 * @throws NotFoundException
445
 * @param string $id
430
 * @param string $id
446
 * @return void
431
 * @return void
447
 */
432
 */
448
	public function admin_delete($id = null) {
433
	public function admin_delete($id = null) {
-
 
434
		$this->checkAcl();
449
		$this->Order->id = $id;
435
		$this->Order->id = $id;
450
		if (!$this->Order->exists()) {
436
		if (!$this->Order->exists()) {
451
			throw new NotFoundException(__('Invalid order'));
437
			throw new NotFoundException(__('Invalid order'));
452
		}
438
		}
453
		$this->request->onlyAllow('post', 'delete');
439
		$this->request->onlyAllow('post', 'delete');