Пример #1
0
 /**
  * Close a sale with a buyer and seller.
  */
 function close_sale()
 {
     $saleId = (int) $this->input->post('saleId');
     $person_id = $this->phpsession->get('personVO')->getPerson_id();
     $mysqltime = date("Y-m-d H:i:s");
     require_once APPPATH . 'models/VOs/SaleVO' . EXT;
     $saleVO = new SaleVO($saleId);
     $saleVO->Load();
     $saleVO->setBuyerId($person_id);
     $saleVO->setComp_date($mysqltime);
     if ($saleVO->Save()) {
         $this->send_sale_emails($saleVO);
         return "You have successfully bought this item. An email has been sent to you and the seller with contact information. Please work with the seller to send payment.";
     } else {
         return "Completion of the sale failed, please contact KLECT.com with the sale Id: {$saleId} for help.";
     }
 }