diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php index d792bde6..667477cb 100644 --- a/controllers/jobs_controller.php +++ b/controllers/jobs_controller.php @@ -17,11 +17,20 @@ class JobsController extends AppController { } function add() { + + + if (!empty($this->data)) { $this->Job->create(); if ($this->Job->save($this->data)) { - $this->flash(__('Job saved.', true), array('action'=>'index')); + $jobid = $this->Job->id; + + $this->Session->setFlash(__('Job Saved', true)); + $this->redirect(array('action'=>'view', $jobid)); } else { + $this->Session->setFlash(__('Please Fix the Errors Below', true)); + $enquiry = $this->Job->Enquiry->findById($this->data['Job']['enquiry_id']); + $this->set(compact('enquiry')); } } else { @@ -37,7 +46,22 @@ class JobsController extends AppController { } } - } + $freight_paid_options = array("CMC"=>"CMC", "Customer"=>"Customer"); + $this->set('freight_paid_options', $freight_paid_options); + + $sale_category_options = array("INDENT"=>"INDENT", "STOCK"=>"STOCK", "COMMISSION"=>"COMMISSION"); + $this->set('sale_category_options', $sale_category_options); + + $shipment_category_options = array( + "AUSTRALIA"=>"AUSTRALIA", + "EXPORT"=>"EXPORT", + "DIRECT-INTL"=>"DIRECT-INTL", + "DIRECT-AUST"=>"DIRECT-AUST", + "NO-SHIP"=>"NO-SHIP" + ); + $this->set('shipment_category_options', $shipment_category_options); + + } function edit($id = null) { if (!$id && empty($this->data)) { diff --git a/models/job.php b/models/job.php index adf0c7d1..cf4e349c 100644 --- a/models/job.php +++ b/models/job.php @@ -4,10 +4,9 @@ class Job extends AppModel { var $name = 'Job'; var $validate = array( 'title' => array('notempty'), - 'state_id' => array('numeric'), - 'customer_id' => array('numeric'), + 'enquiry_id' => array('numeric'), - 'contact_id' => array('numeric'), + 'date_order_received' => array('date'), 'customer_order_number' => array('notempty'), 'domestic_freight_paid_by' => array('notempty'), @@ -17,20 +16,7 @@ class Job extends AppModel { //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( - 'State' => array( - 'className' => 'State', - 'foreignKey' => 'state_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), - 'Customer' => array( - 'className' => 'Customer', - 'foreignKey' => 'customer_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' - ), + 'Enquiry' => array( 'className' => 'Enquiry', 'foreignKey' => 'enquiry_id', @@ -38,13 +24,6 @@ class Job extends AppModel { 'fields' => '', 'order' => '', 'counterCache' => true - ), - 'Contact' => array( - 'className' => 'Contact', - 'foreignKey' => 'contact_id', - 'conditions' => '', - 'fields' => '', - 'order' => '' ) ); diff --git a/vendors/shells/firstpass.php b/vendors/shells/firstpass.php index 0829e0ae..8599db01 100644 --- a/vendors/shells/firstpass.php +++ b/vendors/shells/firstpass.php @@ -66,14 +66,14 @@ class FirstpassShell extends Shell { $message = $this->getMessage($mbox, $i, $this_header); //echo "Checking msg number: $i\tSubject: ".$message['subject']."\n"; - echo "Checking msg number: $i\n"; + //echo "Checking msg number: $i\n"; $enqID = $this->checkIfValidEnquiry($message['subject'], $enquiryList); if($enqID == false) { echo "Deleting msg number: $i\tSubject: ".$message['subject']."\n"; - //imap_delete($mbox, $i); - $discardArray[] = $i; + imap_delete($mbox, $i); + //$discardArray[] = $i; } @@ -84,7 +84,7 @@ class FirstpassShell extends Shell { reset($discardArray); - +/* $numberToDiscard= count($discardArray); @@ -107,19 +107,19 @@ class FirstpassShell extends Shell { } } - + */ imap_expunge($mbox); - echo "Messages before delete: ".$number_of_messages."\n"; + /* echo "Messages before delete: ".$number_of_messages."\n"; $check = imap_check($mbox); echo "Messages after delete: ".$check->Nmsgs."\n"; - +*/ diff --git a/vendors/shells/vault.php b/vendors/shells/vault.php index c7affd63..be38547f 100755 --- a/vendors/shells/vault.php +++ b/vendors/shells/vault.php @@ -158,7 +158,7 @@ class VaultShell extends Shell { } } } - echo "Email stored in the DB under enquiry ID".$enqID." Will be moved to the stored folder\n"; + echo "Email stored in the DB under enquiry ID".$enqID." Message will now be deleted\n"; //$storedArray[] = $i; @@ -181,6 +181,8 @@ class VaultShell extends Shell { } + + } diff --git a/views/enquiries/do_search.ctp b/views/enquiries/do_search.ctp index 02dd941e..0d18892a 100644 --- a/views/enquiries/do_search.ctp +++ b/views/enquiries/do_search.ctp @@ -89,12 +89,24 @@