diff --git a/wrenchboard/src/shared_tool/contract.cc b/wrenchboard/src/shared_tool/contract.cc index dc2462d0..ad6c1cd0 100644 --- a/wrenchboard/src/shared_tool/contract.cc +++ b/wrenchboard/src/shared_tool/contract.cc @@ -50,6 +50,7 @@ long WrenchContractStatus( CVars in, CVars &out ) long job_action = REQ_LONG( in, "job_action", 1, -1 ); out["result"] = "Yes i go to this back end"; long extension = 0; + CVars xy; logfmt( logINFO, "~~~~ ~~~~~ WrenchContractStatus() job_action == %lu", job_action); long retF = load_db_record( out, "SELECT id AS contract_id FROM members_jobs_contract WHERE contract='%s' AND uid = '%s'",in["contract"].c_str(),in["contract_uid"].c_str()); @@ -204,7 +205,14 @@ long WrenchContractStatus( CVars in, CVars &out ) if ( load_db_record( out, "SELECT * FROM members_jobs_contract WHERE id=%lu AND member_id =%lu AND delivery_date > now()",in["contract_id"].Long(),in["member_id"].Long() ) ) { project_email(CONTRACT_REQUEST_TIMELINE, in, out); - out["result"] = "We have requested the timeline increase"; + out["result"] = "We have requested the timeline increase"; + + if ( load_db_record(xy, "SELECT id AS member_id, uid AS member_uid, 'message.svg' AS icon " + " FROM members WHERE id = %lu ",out["member_id"].Long()) > 0 ){ + xy["msg"] = "Task timeline extension was requested"; + xy["msg"].set_valid(true); + plan_notification(xy, out); + } } } @@ -222,7 +230,9 @@ long WrenchContractStatus( CVars in, CVars &out ) logfmt( logINFO, "~~~~ ~~~~~ WrenchContractStatus() ret 1 = %lu",ret ); if (ret>0) { - pgsql_exec("UPDATE members_jobs_contract SET due_remind = NULL, delivery_date = now() +'%lu days' WHERE status IN (1,2) AND id = %lu AND contract='%s'",extension, in["contract_id"].Long() ,in["job_contract"].c_str()); + pgsql_exec("UPDATE members_jobs_contract SET ext_request = NULL, " + " due_remind = NULL, delivery_date = now() +'%lu days' " + " WHERE status IN (1,2) AND id = %lu AND contract='%s'",extension, in["contract_id"].Long() ,in["job_contract"].c_str()); // make sure the update was done if ( load_db_record( out, "SELECT * FROM members_jobs_contract WHERE id=%lu AND member_id =%lu AND delivery_date > now()",in["contract_id"].Long(),in["member_id"].Long() ) ) {