This topic is locked

Return False Not Working

5/20/2013 5:09:00 AM
PHPRunner General questions
P
prattster1874 author

Hi Guys,
Can anyone see what I have done wrong with the code for the following button? If I click cancel on the alert box, it runs through the code anyway and doesn't cancel?
Client Before:

if (confirm('Are you sure you want to authorise this job?')) {

return true;

}

else {

return false;

}


Server

global $dal;
$tbl_jobs = $dal->Table("tbl_jobs");
if ($keys["ID"])
{

//update transactions table

$tbl_job_transactions = $dal->Table("tbl_job_transactions");

$tbl_job_transactions->auth_status = '1';

$tbl_job_transactions->job_id = $keys['job_number'];

$tbl_job_transactions->user = $_SESSION['UserID'];

$tbl_job_transactions->time_stamp = now();

$tbl_job_transactions->add();
//change authorisation status

$tbl_jobs = $dal->Table("tbl_jobs");

$tbl_jobs->ID = $keys["ID"];

$tbl_jobs->authorisation_id = '1';

$tbl_jobs->update();
//get additional vehicle details for the email
//get the additional IDs

$rs = $tbl_jobs->Query("job_number='".$keys['job_number']."'","vehicle_id","depot_id");

$data = db_fetch_array($rs);

//get the reg number from the vehicle ID

$tbl_vehicles = $dal->Table("tbl_vehicle");

$rs2 = $tbl_vehicles->Query("id='".$data['vehicle_id']."'","reg_number");

$vehicle_data = db_fetch_array($rs2);
//get email address to send to!

//get the depot email

$tbl_depots = $dal->Table("tbl_depots");

$rs3 = $tbl_depots->Query("id='".$data['depot_id']."'","depot_email");

$depot_data = db_fetch_array($rs3);
$email_msg = "";
$email_msg.= $tbl_jobs->ID;
$email_msg.= "\r\n";

//send email
$email = $depot_data['depot_email'];
$subject = "WIP No.".$keys['job_number']." Authorised";
$email_msg = "WIP No.".$keys['job_number']." for Vehicle Registration number: ".$vehicle_data['reg_number']." has been Authorised, and you can now perform the repair as agreed.
Regards,
runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $email_msg));
}
$result["txt"] = "Job Authorised";


Client After:

location.reload();
C
cgphp 5/20/2013

Upgrade to the most recent version of PHPrunner.

Sergey Kornilov admin 5/20/2013

Try upgrading to the latest version fist and if this doesn't help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

P
prattster1874 author 5/20/2013



Try upgrading to the latest version fist and if this doesn't help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


Thanks for the reply, do you mean purchase the latest version? Or is there a later build for the version I have? If so, how do I get it?

Sergey Kornilov admin 5/20/2013

What Cristian saying is that if there were any issues in PHPRunner code itself they were fixed in the latest build. You can find which build is the latest one at PHPRunner change log: http://www.asprunner.com/forums/forum/26-asprunnerphprunner-change-log/