public function pjActionDeleteClientBulk()
 {
     $this->setAjax(true);
     if ($this->isXHR()) {
         if (isset($_POST['record']) && count($_POST['record']) > 0) {
             pjClientModel::factory()->whereIn('id', $_POST['record'])->eraseAll();
             $pjOrderModel = pjOrderModel::factory();
             $order_id_arr = $pjOrderModel->whereIn('t1.client_id', $_POST['record'])->findAll()->getDataPair("id", "id");
             if (!empty($order_id_arr)) {
                 $pjOrderModel->reset()->whereIn('id', $order_id_arr)->eraseAll();
                 pjOrderItemModel::factory()->whereIn('order_id', $order_id_arr)->eraseAll();
                 pjOrderPaymentModel::factory()->whereIn('order_id', $order_id_arr)->eraseAll();
             }
         }
     }
     exit;
 }
 public function pjActionConfirmPaypal()
 {
     $this->setAjax(true);
     if (pjObject::getPlugin('pjPaypal') === NULL) {
         $this->log('Paypal plugin not installed');
         exit;
     }
     $pjOrderModel = pjOrderModel::factory();
     $order_arr = $pjOrderModel->join('pjClient', "t2.id=t1.client_id", 'left outer')->select('t1.*, t2.c_title, t2.c_email, t2.c_name, t2.c_phone, t2.c_company, t2.c_address_1, t2.c_address_2, t2.c_country, t2.c_state, t2.c_city, t2.c_zip, t2.c_notes')->find($_POST['custom'])->getData();
     if (count($order_arr) == 0) {
         $this->log('No such booking');
         pjUtil::redirect($this->option_arr['o_thankyou_page']);
     }
     $params = array('txn_id' => @$order_arr['txn_id'], 'paypal_address' => $this->option_arr['o_paypal_address'], 'deposit' => @$order_arr['total'], 'currency' => $this->option_arr['o_currency'], 'key' => md5($this->option_arr['private_key'] . PJ_SALT));
     $response = $this->requestAction(array('controller' => 'pjPaypal', 'action' => 'pjActionConfirm', 'params' => $params), array('return'));
     if ($response !== FALSE && $response['status'] === 'OK') {
         $this->log('Booking confirmed');
         $pjOrderModel->reset()->setAttributes(array('id' => $pjOrderModel['id']))->modify(array('status' => $this->option_arr['o_payment_status'], 'txn_id' => $response['transaction_id'], 'processed_on' => ':NOW()'));
         pjOrderPaymentModel::factory()->setAttributes(array('order_id' => $order_arr['id'], 'payment_type' => 'online'))->modify(array('status' => 'paid'));
         pjAppController::addOrderDetails($order_arr, $this->getLocaleId());
         pjFront::pjActionConfirmSend($this->option_arr, $order_arr, PJ_SALT, 'payment');
     } elseif (!$response) {
         $this->log('Authorization failed');
     } else {
         $this->log('Booking not confirmed');
     }
     pjUtil::redirect($this->option_arr['o_thankyou_page']);
 }