diff --git a/application/config/constants.php b/application/config/constants.php index d8d657e..cbf4252 100644 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -101,7 +101,8 @@ define('UPLOAD_FILE_SIZE',1); define('OFFER_ACCEPT',100); define('OFFER_REJECT',333); define('OFFER_CANCEL',222); -define('OFFER_EXPIRE',444); +define('OFFER_EXPIRE',444); +define('OFFER_NOREFU',445); define('OFFER_SENDTOME',777); diff --git a/application/controllers/Bkotransaction.php b/application/controllers/Bkotransaction.php index 930dcff..9b280cc 100644 --- a/application/controllers/Bkotransaction.php +++ b/application/controllers/Bkotransaction.php @@ -384,6 +384,35 @@ class Bkotransaction extends Bko_Controller { $this->renderbkopage($data); } + public function zero_refund_offer() { + // $out = array(); + $out['member_id'] = 0; + $offer_result = OFFER_NOREFU; + $jobOfferID = $this->input->get('link_id'); + $mysql = "SELECT member_id,offer_code FROM members_jobs_offer WHERE id = " . $jobOfferID . " AND status IN (1,2) AND payment_id IS NOT NULL"; + $query = $this->db->query($mysql); + $out = $query->result_array(); + // print_r($out); + // echo 'got here '.$out[0]['member_id']; + $in = array(); + if ($out[0]['member_id'] > 0 && $jobOfferID > 0) { + $in['offer_code'] = $out[0]['offer_code']; // + $in['member_id'] = $out[0]['member_id']; + $in['offer_result'] = $offer_result; + $in['action'] = WRENCHBOARD_JOB_OFFER_CONCLUDE; + $this->load->model('backend_model'); + + $res = $this->backend_model->wrenchboard_api($in, $out); + if ($out["result"] == "OK") { + switch ($offer_result) { + case OFFER_EXPIRE: + echo "You have cancelled this offer and no refund to the user."; + break; + } + } + } + } + public function refund_offer() { // $out = array(); $out['member_id'] = 0; @@ -429,13 +458,14 @@ class Bkotransaction extends Bko_Controller { . " FROM members_jobs_offer WHERE expire < now() AND status = 1 AND payment_id IS NOT NULL"; - $mysql = "SELECT j.added||'
'||j.offer_code AS cc1,'From: '||m1.email||'-'||m1.firstname||' '||m1.lastname||'
To: '||m2.email||'-'||m2.firstname||' '||m2.lastname AS client ," + $mysql = "SELECT j.added::date||'
'||j.offer_code AS cc1,'From: '||m1.email||'-'||m1.firstname||' '||m1.lastname||'
To: '||m2.email||'-'||m2.firstname||' '||m2.lastname AS client ," . "'
' As Refund, " - . "j.job_description " + . "'
' As Zero, " + . "j.job_description, j.status,j.refund_auto,j.refund_status " . "FROM members_jobs_offer j " . "LEFT JOIN members m1 ON m1.id=j.member_id " . "LEFT JOIN members m2 ON m2.id=j.client_id " - . " WHERE j.expire < now() AND j.status = 1 AND j.payment_id IS NOT NULL"; + . " WHERE j.expire < now() AND j.status = 1 AND j.payment_id IS NOT NULL ORDER BY j.id DESC"; $this->load->library('table'); diff --git a/application/views/bko/view_bko_expiredoffer.php b/application/views/bko/view_bko_expiredoffer.php index 6dc0001..e4ef621 100644 --- a/application/views/bko/view_bko_expiredoffer.php +++ b/application/views/bko/view_bko_expiredoffer.php @@ -47,6 +47,23 @@ return false; } +function zeroOffer(link_id) { + if (confirm("Are you sure you want to cancel and zero this this offer?")) { +// do something + } else { + return false; + } + $('#btu' + link_id).html('Processing...'); + $('#acc' + link_id).prop('disabled', true); + $.ajax({ + url: "/bkotransaction/zero_refund_offer?link_id=" + link_id + }).done(function (data) { + $('#btu' + link_id).html(data); + // document.offer_individual.rec_email.value = ''; + $('#acc' + link_id).prop('disabled', false); + }); + return false; +} // -->