| @@ -14,19 +14,15 @@ | ||
| 14 | 14 | 'other_field' => 'shift', |
| 15 | 15 | ), |
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | - const STATUS_ACTIVE = 1; // Published, With Staff | |
| 19 | - const STATUS_DRAFT = 2; // Not Published, No Staff | |
| 20 | - const STATUS_OPEN = 3; // not saved - Published, No Staff | |
| 21 | - const STATUS_PENDING = 4; // not saved - Not Published, With Staff | |
| 18 | + const STATUS_ACTIVE = 1; | |
| 19 | + const STATUS_DRAFT = 2; | |
| 22 | 20 | |
| 23 | 21 | var $prop_text = array( |
| 24 | 22 | 'status' => array( |
| 25 | 23 | self::STATUS_ACTIVE => array( 'lang:shift_status_active', 'success' ), |
| 26 | 24 | self::STATUS_DRAFT => array( 'lang:shift_status_draft', 'warning' ), |
| 27 | - self::STATUS_OPEN => array( 'lang:shift_status_open', 'danger' ), | |
| 28 | - self::STATUS_PENDING => array( 'lang:shift_status_pending', 'info' ), | |
| 29 | 25 | ), |
| 30 | 26 | ); |
| 31 | 27 | |
| 32 | 28 | var $validation = array( |
| @@ -88,44 +84,13 @@ | ||
| 88 | 84 | 'name' => 'status', |
| 89 | 85 | 'label' => 'lang:shift_status', |
| 90 | 86 | 'hide' => TRUE, |
| 91 | 87 | ), |
| 92 | - array( | |
| 93 | - 'name' => 'has_trade', | |
| 94 | - 'label' => 'lang:trade_request', | |
| 95 | - 'type' => 'boolean', | |
| 96 | - 'hide' => TRUE, | |
| 97 | - 'default' => 0, | |
| 98 | - ), | |
| 99 | 88 | ); |
| 100 | 89 | |
| 101 | - public function get_status() | |
| 90 | + public function view_text() | |
| 102 | 91 | { |
| 103 | - /* ACTIVE - published with staff */ | |
| 104 | - /* OPEN - published with no staff */ | |
| 105 | - /* PENDING - not published with staff */ | |
| 106 | - /* DRAFT - not published with no staff */ | |
| 107 | - | |
| 108 | - if( $this->status == self::STATUS_ACTIVE ) | |
| 109 | - { | |
| 110 | - if( $this->user_id ) | |
| 111 | - $return = self::STATUS_ACTIVE; | |
| 112 | - else | |
| 113 | - $return = self::STATUS_OPEN; | |
| 114 | - } | |
| 115 | - else | |
| 116 | - { | |
| 117 | - if( $this->user_id ) | |
| 118 | - $return = self::STATUS_PENDING; | |
| 119 | - else | |
| 120 | - $return = self::STATUS_DRAFT; | |
| 121 | - } | |
| 122 | - return $return; | |
| 123 | - } | |
| 124 | - | |
| 125 | - public function view_text( $skip = array() ) | |
| 126 | - { | |
| 127 | - $return = parent::view_text( $skip ); | |
| 92 | + $return = parent::view_text(); | |
| 128 | 93 | unset( $return['start'] ); |
| 129 | 94 | unset( $return['end'] ); |
| 130 | 95 | unset( $return['status'] ); |
| 131 | 96 | $return['date'][1] = $this->date_view(); |
| @@ -145,9 +110,9 @@ | ||
| 145 | 110 | { |
| 146 | 111 | $return = ''; |
| 147 | 112 | if( $html ) |
| 148 | 113 | { |
| 149 | - $return .= '<i class="fa fa-clock-o"></i> '; | |
| 114 | + $return .= '<i class="icon-time"></i> '; | |
| 150 | 115 | } |
| 151 | 116 | else |
| 152 | 117 | { |
| 153 | 118 | $return .= lang('shift') . ': '; |
| @@ -284,7 +249,26 @@ | ||
| 284 | 249 | /* delete notes */ |
| 285 | 250 | if( $CI->hc_modules->exists('notes') ) |
| 286 | 251 | { |
| 287 | 252 | $this->note->get()->delete_all(); |
| 253 | + } | |
| 254 | + | |
| 255 | + /* delete trades */ | |
| 256 | + if( $CI->hc_modules->exists('shift_trades') ) | |
| 257 | + { | |
| 258 | + $this->trade->get()->delete_all(); | |
| 259 | + } | |
| 260 | + } | |
| 261 | + | |
| 262 | + protected function _after_save() | |
| 263 | + { | |
| 264 | + $changes = $this->get_changes(); | |
| 265 | + if( isset($changes['id']) ) | |
| 266 | + { | |
| 267 | + $log = array( | |
| 268 | + 'action_name' => 'create', | |
| 269 | + 'action_details' => '' | |
| 270 | + ); | |
| 271 | + $this->_add_log( $log ); | |
| 288 | 272 | } |
| 289 | 273 | } |
| 290 | 274 | } |