From f037f03a08ef51d5defb108a71f80e2c4c996a26 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Thu, 12 Jan 2017 15:45:29 +0530 Subject: fixed bug --- pdf/generate_pdf.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pdf/generate_pdf.inc b/pdf/generate_pdf.inc index af9e361..5dd91c5 100755 --- a/pdf/generate_pdf.inc +++ b/pdf/generate_pdf.inc @@ -11,10 +11,16 @@ function generate_pdf() ':prop_id' => $proposal_id )); $data2 = $query2->fetchObject(); - $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id= :prop_id", array( + $query3 = db_query("SELECT * FROM {textbook_companion_proposal} WHERE id= :prop_id AND proposal_status =3", array( ':prop_id' => $proposal_id )); $data3 = $query3->fetchObject(); + if($data3){ + if($data3->uid != $x){ + drupal_set_message('Certificate is not available','error'); + return; + } + } $query4 = db_query("SELECT COUNT( tce.id ) AS example_count FROM textbook_companion_example tce LEFT JOIN textbook_companion_chapter tcc ON tce.chapter_id = tcc.id LEFT JOIN textbook_companion_preference tcpe ON tcc.preference_id = tcpe.id @@ -23,6 +29,10 @@ function generate_pdf() ':prop_id' => $proposal_id )); $data4 = $query4->fetchObject(); + if($data4->example_count == 0) { + drupal_set_message('Certificate is not available','error'); + return; + } $number_of_example = $data4->example_count; $gender = array( 'salutation' => 'Mr. /Ms.', -- cgit