Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach($sources->Source AS $source):
- $PID = null;
- //insert/update paper Group as paper if it exists in node
- if($source->PaperGroup != ''){
- $this->db_interface->setSQL("SELECT * FROM exp_st_papers WHERE Name ='".$source->PaperGroup."'");
- $this->db_interface->db_query();
- if($this->db_interface->getError()){die('paper group select : '.$this->db_interface->getError());}
- $results = $this->db_interface->getResults();
- $insertData = array('Name' => $source->PaperGroup, 'Type' => $source->PaperType, 'Status' => $source->PaperStatus);
- $this->db_interface->setInsertData($insertData);
- $this->db_interface->setWhere(' ID = '.$results->row['ID']);
- $this->db_interface->switchTable('exp_st_papers');
- //var_dump('paper group num rows: '.$results->row['ID']);
- if($results->num_rows == 0){
- $this->db_interface->db_insert();
- }else{
- $this->db_interface->db_update();
- }
- if($this->db_interface->getError()){die('paper group inser/update : '.$this->db_interface->getError());}
- $this->db_interface->setSQl("SELECT * FROM exp_st_papers WHERE Name ='".$source->PaperGroup."'");
- $this->db_interface->db_query();
- $results = $this->db_interface->getResults();
- $PID = $results->row['ID'];
- }
- //insert/update paper
- $this->db_interface->setSQL("SELECT * FROM exp_st_papers WHERE Name ='".$source->PaperName."'");
- $this->db_interface->db_query();
- $results = $this->db_interface->getResults();
- $paperInsertData = array('Name' => $source->PaperName, 'Type' => $source->PaperType, 'Status' => $source->PaperStatus);
- $this->db_interface->setInsertData($paperInsertData);
- $this->db_interface->switchTable('exp_st_papers');
- $this->db_interface->setWhere(' ID = '.$results->row['ID']);
- if($results->num_rows == 0){
- $this->db_interface->db_insert();
- }else{
- $this->db_interface->db_update();
- }
- $this->db_interface->setSQL("SELECT * FROM exp_st_papers WHERE Name ='".$source->PaperName."'");
- $this->db_interface->db_query();
- $results = $this->db_interface->getResults();
- $PaperID = $results->row['ID'];
- //insert/update sources
- $this->db_interface->setSQL("SELECT * FROM exp_st_paper_sources WHERE SourceID =".$source->SourceID);
- $this->db_interface->db_query();
- $results = $this->db_interface->getResults();
- $sourceInsertData = array('SourceName' => $source->SourceName, 'SourceType' => $source->SourceType, 'PaperID' => $PaperID, 'SourceID' => $source->SourceID, 'ValidFrom' => $source->ValidFrom, 'EnqValidTo' => $source->EnqValidTo, 'BkValidTo' => $source->BkgValidTo, 'Brochure' => $source->Brochure, 'Size' => $source->Size, 'MasterTourCode' => $source->MasterTourCode, 'ResponseType' => $source->ResponseType);
- $this->db_interface->setInsertData($sourceInsertData);
- $this->db_interface->switchTable('exp_st_paper_sources');
- $this->db_interface->setWhere(' ID = '.$results->row['ID']);
- if($results->num_rows == 0){
- $this->db_interface->db_insert();
- }else{
- $this->db_interface->db_update();
- }
- endforeach;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement