fix
This commit is contained in:
@@ -18,6 +18,8 @@ enum { PARTNER_STRIPE };
|
||||
#define OFFER_REJECT 333
|
||||
#define OFFER_CANCEL 222
|
||||
#define OFFER_EXPIRE 444
|
||||
#define OFFER_EXTEND 555
|
||||
|
||||
#define OFFER_SENDTOME 777
|
||||
|
||||
#define WEBSITE_LOGIN 1100
|
||||
|
||||
@@ -365,6 +365,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
REQ_STRING(in, "offer_code", 1, 15, "(.*)");
|
||||
|
||||
long rc = 0;
|
||||
CVars outx;
|
||||
// rc = 0 + load_db_record( out, "SELECT * FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str() );
|
||||
|
||||
|
||||
@@ -373,43 +374,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
load_db_record(out, "SELECT jo.member_id AS owner_member_id,jo.id AS offer_id, j.id AS job_id,jo.added::date AS added_date,j.title,j.description, j.timeline_days, j.price,jo.offer_code,jo.job_description,jo.expire FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id WHERE jo.expire > now() AND jo.status = 1 AND jo.client_id = %lu AND jo.offer_code='%s'", in["member_id"].Long(), in["offer_code"].c_str());
|
||||
|
||||
/*
|
||||
wrenchboard=>
|
||||
wrenchboard=>
|
||||
wrenchboard=>
|
||||
wrenchboard=> \d members_jobs_contract
|
||||
Table "public.members_jobs_contract"
|
||||
Column | Type | Modifiers
|
||||
---------------+-----------------------------+--------------------------------------------------------------------
|
||||
id | integer | not null default nextval('members_jobs_contract_id_seq'::regclass)
|
||||
job_id | integer | default 0
|
||||
contract | character varying(25) | not null
|
||||
member_id | integer |
|
||||
client_id | integer |
|
||||
title | character varying(150) |
|
||||
description | character varying(300) |
|
||||
job_detail | text |
|
||||
timeline_days | integer | not null
|
||||
price | integer | not null
|
||||
loc | inet |
|
||||
client_signed | timestamp without time zone |
|
||||
created | timestamp without time zone | default now()
|
||||
updated | timestamp without time zone | default now()
|
||||
status | integer | default 1
|
||||
Indexes:
|
||||
"members_jobs_contract_contract_key" UNIQUE CONSTRAINT, btree (contract)
|
||||
"members_jobs_contract_id_key" UNIQUE CONSTRAINT, btree (id)
|
||||
Foreign-key constraints:
|
||||
"members_jobs_contract_client_id_fkey" FOREIGN KEY (client_id) REFERENCES members(id)
|
||||
"members_jobs_contract_member_id_fkey" FOREIGN KEY (member_id) REFERENCES members(id)
|
||||
Referenced by:
|
||||
TABLE "jobs_contract_message" CONSTRAINT "jobs_contract_message_contract_fkey" FOREIGN KEY (contract) REFERENCES members_jobs_contract(contract)
|
||||
|
||||
wrenchboard=>
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
in["offer_id"] = out["offer_id"];
|
||||
in["offer_id"].set_valid(true);
|
||||
|
||||
@@ -418,6 +383,14 @@ TABLE "jobs_contract_message" CONSTRAINT "jobs_contract_message_contract_fkey" F
|
||||
long contract_id = 0;
|
||||
|
||||
switch (offer_result) {
|
||||
case OFFER_EXTEND:
|
||||
logfmt(logINFO, "WrenchConcludeJobsOffer() rc=OFFER_EXTEND");
|
||||
// You can only extend your jobs only
|
||||
if( load_db_record(outx, "SELECT id AS offer_id,* FROM members_jobs_offer WHERE offer_code='%s' AND status = 1 AND member_id=%lu", in["offer_code"].c_str(),in["member_id"].Long()) ){
|
||||
pgsql_exec("UPDATE members_jobs_offer SET expire = expire +'7 days' WHERE id = %lu AND offer_code='%s' ", outx["offer_id"].Long(), outx["offer_code"].c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OFFER_SENDTOME:
|
||||
job_email(JOBS_OFFER_SENDTOME_MAIL, in, out); // the email will come from
|
||||
|
||||
Reference in New Issue
Block a user