Offer id
This commit is contained in:
@@ -533,6 +533,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
REQ_STRING(in, "offer_code", 1, 15, "(.*)");
|
||||
long job_id = 0;
|
||||
long owner_member_id = 0;
|
||||
long offer_id = 0;
|
||||
|
||||
long rc = 0;
|
||||
CVars outx;
|
||||
@@ -540,7 +541,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
|
||||
|
||||
|
||||
const PGresult *res = pgsql_query("SELECT *,member_id AS owner_member_id FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str());
|
||||
const PGresult *res = pgsql_query("SELECT *,member_id AS owner_member_id, id AS offer_id FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str());
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
|
||||
// now job is valid
|
||||
@@ -550,6 +551,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
job_id = rec["job_id"];
|
||||
offer_id = rec["offer_id"];
|
||||
owner_member_id = rec["owner_member_id"];
|
||||
}
|
||||
|
||||
@@ -617,8 +619,8 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
in["contract_id"] = contract_id;
|
||||
in["contract_id"].set_valid(true);
|
||||
pgsql_exec("UPDATE members_jobs_contract SET delivery_date = now() +'%lu days' WHERE id = %lu", x["timeline_days"].Long(), contract_id);
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 5 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str());
|
||||
pgsql_exec("UPDATE members_payments SET what_contract = %lu WHERE what_offer = %lu ", contract_id, in["offer_id"].Long());
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 5 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str());
|
||||
pgsql_exec("UPDATE members_payments SET what_contract = %lu WHERE what_offer = %lu ", contract_id, offer_id);
|
||||
job_email(JOBS_OFFER_ACCEPT_MAIL, in, out); // note the email will come from contract table now
|
||||
}
|
||||
|
||||
@@ -641,7 +643,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
y["payment_id"].set_valid(true);
|
||||
|
||||
if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) {
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 3 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str());
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 3 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str());
|
||||
// REFUND THE MONEY
|
||||
job_email(JOBS_OFFER_REJECT_MAIL, in, out); // the email will come from offer table
|
||||
}
|
||||
@@ -665,7 +667,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
y["payment_id"].set_valid(true);
|
||||
|
||||
if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) {
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str());
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str());
|
||||
// REFUND THE MONEY
|
||||
job_email(JOBS_OFFER_CANCEL_MAIL, y, out); // the email will come from offer table
|
||||
}
|
||||
@@ -688,7 +690,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
y["payment_id"] = out["payment_id"];
|
||||
y["payment_id"].set_valid(true);
|
||||
if (WrenchRefundoffer(y, out) == PHP_CREATED_OK) {
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", out["offer_id"].Long(), in["offer_code"].c_str());
|
||||
pgsql_exec("UPDATE members_jobs_offer SET status = 4 WHERE id = %lu AND offer_code='%s' ", offer_id, in["offer_code"].c_str());
|
||||
// REFUND THE MONEY
|
||||
//job_email(JOBS_OFFER_CANCEL_MAIL, in, out); // the email will come from offer table
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ $routes->post('/en/wrench/api/v1/assigntask', 'WrenchApi::apigate');
|
||||
//$routes->post('/en/wrench/api/v1/blogitem', 'WrenchBlog::apigate');
|
||||
|
||||
|
||||
$routes->get('/en/wrench/api/v1/resources', 'WrenchResources::website');
|
||||
$routes->post('/en/wrench/api/v1/resources', 'WrenchResources::website');
|
||||
$routes->get('/en/wrench/api/v1/blogdata/', 'WrenchBlog::website');
|
||||
$routes->get('/en/wrench/api/v1/blogdata/(:any)', 'WrenchBlog::blogLimitedData/$1');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user