Guest User

Untitled

a guest
Sep 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.04 KB | None | 0 0
  1. diff --git a/application/admin/index/controllers/ProposalsController.php b/application/admin/index/controllers/ProposalsController.php
  2. index 9d50637..2856ed4 100644
  3. --- a/application/admin/index/controllers/ProposalsController.php
  4. +++ b/application/admin/index/controllers/ProposalsController.php
  5. @@ -293,8 +293,24 @@ class ProposalsController extends IP_Controller_EventAction {
  6.             $post = $this->getRequest()->getPost();
  7.             $value = $post['newPersonnel'];
  8.             foreach($value as $val) {
  9. -               $personnelData = explode(":", $val['personnelNameValue']);
  10. -               $personnelID = $personnelData[1];
  11. +               if ($val['personnelNameValue']) {
  12. +                   $personnelData = explode(":", $val['personnelNameValue']);
  13. +                   $personnelID = $personnelData[1];
  14. +               } else {
  15. +                   $select = MyDB::getInstance()->select()
  16. +                                     ->from(array('smp'=>SessionManagementPersonnel::TABLE), array(),
  17. +                                             $this->getEvent()->getDatabase())
  18. +                                     ->join(array('p'=>Profiles::TABLE),
  19. +                                            'smp.profileID = p.recordID',
  20. +                                             array('profileID'=>'smp.profileID'),
  21. +                                             $this->getEvent()->getDatabase())
  22. +                                    ->where('p.email = ?', $val['personnelName']);
  23. +                   $personnel = MyDB::getInstance()->fetchRow($select);
  24. +                   $personnelID = $personnel['profileID'];
  25. +               }
  26. +               if(is_null($personnelID)) {
  27. +                    throw new IP_Controller_Action_ErrorException(IP::_('SessionManagementPersonnel::INVALID_PERSONNEL'), "proposals/edit/proposalID/$preID");
  28. +               }
  29.                 $pp = $obj->ProposalPersonnel->createRow();
  30.                 $pp->roleID = $val['personnelRole'];
  31.                 $pp->proposalID = $preID;
  32. diff --git a/application/admin/index/controllers/SessionsController.php b/application/admin/index/controllers/SessionsController.php
  33. index eaaa8ad..97f0a42 100644
  34. --- a/application/admin/index/controllers/SessionsController.php
  35. +++ b/application/admin/index/controllers/SessionsController.php
  36. @@ -397,8 +397,24 @@ class SessionsController extends IP_Controller_EventAction {
  37.                         $post = $this->getRequest()->getPost();
  38.                         $value = $post['newPersonnel'];
  39.                         foreach($value as $val) {
  40. -                           $personnelData = explode(":", $val['personnelNameValue']);
  41. -                           $personnelID = $personnelData[1];
  42. +                           if ($val['personnelNameValue']) {
  43. +                               $personnelData = explode(":", $val['personnelNameValue']);
  44. +                               $personnelID = $personnelData[1];
  45. +                           } else {
  46. +                               $select = MyDB::getInstance()->select()
  47. +                                     ->from(array('smp'=>SessionManagementPersonnel::TABLE), array(),
  48. +                                             $this->getEvent()->getDatabase())
  49. +                                     ->join(array('p'=>Profiles::TABLE),
  50. +                                            'smp.profileID = p.recordID',
  51. +                                             array('profileID'=>'smp.profileID'),
  52. +                                             $this->getEvent()->getDatabase())
  53. +                                    ->where('p.email = ?', $val['personnelName']);
  54. +                               $personnel = MyDB::getInstance()->fetchRow($select);
  55. +                               $personnelID = $personnel['profileID'];
  56. +                           }
  57. +                           if(is_null($personnelID)) {
  58. +                                throw new IP_Controller_Action_ErrorException(IP::_('SessionManagementPersonnel::INVALID_PERSONNEL'), "sessions/edit/sessionID/$preID");
  59. +                           }
  60.                             $sp = $obj->SessionPersonnel->createRow();
  61.                             $sp->roleID = $val['personnelRole'];
  62.                             $sp->sessionID = $preID;
  63. @@ -642,6 +658,9 @@ class SessionsController extends IP_Controller_EventAction {
  64.                 } catch (MessageException $me) {
  65.                     IP_Log::debug($me);
  66.                     $this->_helper->MessageBroker->error($me->getMessage());
  67. +               }  catch (IP_Controller_Action_ErrorException $ipe) {
  68. +                   IP_Log::debug($ipe->getMessage());
  69. +                   $this->_helper->MessageBroker->error($ipe->getMessage());
  70.                 } catch (Exception $e) {
  71.                     IP_Log::debug($e);
  72.                     $this->_helper->MessageBroker->error(IP::_('Sessions::SESSION_SAVE_FAILED'));
  73. diff --git a/application/admin/index/scripts/sessions/edit.phtml b/application/admin/index/scripts/sessions/edit.phtml
  74. index 3d15e9f..3a3e7f2 100644
  75. --- a/application/admin/index/scripts/sessions/edit.phtml
  76. +++ b/application/admin/index/scripts/sessions/edit.phtml
  77. @@ -136,7 +136,7 @@ $this->ip()->startContainer();
  78.                 $this->ip()->sectionTitle('Personnel');
  79.             } else if (((Zend_Auth::getInstance()->getIdentity()->getUser()->canWriteObject('Sessions', 'page_addperson') === true) || !$this->notFullAccess) && ($this->tabAccess != true)) {
  80.                 $this->ip()->sectionTitle('Personnel    
  81. -                   <a href="#"><img src="' . IP::getInstance()->getAssetsUrl() . IP::ADD_IMAGE . '" id="addExistingPersonnelButton" class="left pointer addPersonne" title="Add Existing Personnel" alt="Add Existing Personnel"/></a>
  82. +                   <a href="#"><img src="' . IP::getInstance()->getAssetsUrl() . IP::ADD_IMAGE . '" id="addExistingPersonnelButton" class="left pointer addPersonnel" title="Add Existing Personnel" alt="Add Existing Personnel"/></a>
  83.                     <span class="titleDescription">Add Existing Personnel</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  84.                     <a href="' . IP::getInstance()->getBaseUrl() . '/sessions/addperson/sessionID/' . $this->sessionID . '">
  85.                     <img src="' . IP::getInstance()->getAssetsUrl() . IP::ADD_IMAGE . '" id="addPersonnelButton" class="left pointer" title="Add New Personnel" alt="Add New Personnel"/></a>
  86. diff --git a/model/SessionManagementPersonnel.php b/model/SessionManagementPersonnel.php
  87. index f481412..81cac19 100644
  88. --- a/model/SessionManagementPersonnel.php
  89. +++ b/model/SessionManagementPersonnel.php
  90. @@ -27,6 +27,7 @@ class SessionManagementPersonnel extends IP_Db_Table_EventAbstract
  91.  
  92.     const LABEL_NUMSESSIONS = 'Number of Sessions';
  93.     const LABEL_NUMPROPOSALS = 'Number of Proposals';
  94. +   const INVALID_PERSONNEL = "Invalid Personnel";
  95.  
  96.     protected function getTableName() {
  97.          return self::TABLE;
Add Comment
Please, Sign In to add comment