php - Issue in accessing a supposedly disabled function in CODEIGNITER -


I realized a very important problem in my application. This is about the rent function. What happens, even an applicant has already been hired, if the customer clicks on the reject button on the page of proposals, then the status is rejected from "Approved".

I think I should change something in this part:

  public function accepted_job_propposel ($ job_id, $ provider_id, $ proposal_id) {// updated job status to " Off "when a proposal is already approved / approved $ data = array ('Provider_id' = & gt; $ provider_id, 'status' = & gt;" Award "); $ This- & gt; Db- & gt; Where ('id', $ job_id); $ This- & gt; Db- & gt; Updates ('jobs', $ data); $ Data = array ('condition' = & gt; "approved"); $ This- & gt; Db- & gt; Where ('id', $ proposal_id); $ This- & gt; Db- & gt; Update ('job_proppos', $ data); } Public Work Disclaimed_JPROPSAL ($ job_id, $ provider_id, $ proposal_id) {// Update Provider's Job Offer "Disapproved" $ data = array ('condition' = & gt; "Disapproved"); $ This- & gt; Db- & gt; Where ('id', $ proposal_id); $ This- & gt; Db- & gt; Update ('job_proppos', $ data); }   

How can I disable any button if a customer has already placed such a provider?

Thanks in advance!

You can check your database to ensure that the proposal already contains these lines Some have not been accepted as if you want to do it for both examples (accept and reject), then you can move the investigation into an additional task to see that a proposal is already ' End 'status (i.e. approved or denied) Is not.

A sample may be extra for your reject_zubpropplet method ...

  public function declines_public_update ($ job_id, $ provider_id, $ proposal_id ) {$ this - & gt; Db- & gt; ('Status'); $ This- & gt; Db- & gt; ('job_proposal'); $ This- & gt; Db- & gt; Where ('id', $ proposal_id); $ Query = $ this- & gt; Db- & gt; get receive (); $ Result = $ query- & gt; Line (); If ($ Result-> Status === 'Approved') {// Throw error message, e.g. 'Sorry, this work has been accepted!' Return; } ...}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -