summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashantsinalkar2017-01-12 15:45:29 +0530
committerprashantsinalkar2017-01-12 15:45:29 +0530
commitf037f03a08ef51d5defb108a71f80e2c4c996a26 (patch)
tree76ee6f597473d24fa1f520f084ef23e1c703e88e
parent691bf375964d76eea4025d15df75429c0823fe08 (diff)
downloadDWSIM_textbook_companion-f037f03a08ef51d5defb108a71f80e2c4c996a26.tar.gz
DWSIM_textbook_companion-f037f03a08ef51d5defb108a71f80e2c4c996a26.tar.bz2
DWSIM_textbook_companion-f037f03a08ef51d5defb108a71f80e2c4c996a26.zip
fixed bug
-rwxr-xr-xpdf/generate_pdf.inc12
1 files changed, 11 insertions, 1 deletions
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.',