Changeset 5983
- Timestamp:
- 04/20/12 15:26:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/mail/interceptors/Helpers.php
r5977 r5983 69 69 } 70 70 71 //label:before.create72 public function verifyNameLabel(&$uri , &$params , &$criteria , $original){73 $nameLabel = $params['name'];74 $Labels = Controller::find(array('concept' => 'label'), false, array('filter' => array('i=', 'name', $nameLabel) ));75 if($Labels){76 Throw new Exception('Já existe um marcador com esse nome.');77 }78 }79 80 71 public static function in_arrayr($needle, $haystack) { 81 72 //if(!is_array($haystack)) return false; … … 322 313 } 323 314 315 //label:before.create 316 public function validateLabel(&$uri , &$params , &$criteria , $original){ 317 318 if( !!Controller::find( array('concept' => 'label'), false, array('filter' => array('i=', 'name', $params['name'])) ) ) 319 { 320 throw new Exception('Já existe um marcador com esse nome.'); 321 } 322 323 $used = Controller::read( array( 'concept' => 'label', 'id' => '1' ), array( 'id' ), array( 'uid' => Config::me('uidNumber') ) ); 324 325 if( !isset( $used['id'] ) ) 326 { 327 $params['id'] = '1'; 328 return; 329 } 330 331 $slot = Controller::service('PostgreSQL')->execSql( 'SELECT label.slot + 1 as id FROM expressomail_label as label, phpgw_config as config WHERE label.user_id = '.Config::me('uidNumber').' AND config.config_name = \'expressoMail_limit_labels\' AND label.slot <= config.config_value::integer AND ( SELECT count(slot) FROM expressomail_label WHERE slot = label.slot + 1 AND user_id = '.Config::me('uidNumber').' ) = 0 limit 1', true ); 332 333 if( empty( $slot ) ) 334 { 335 throw new Exception('Nenhum slot disponivel.'); 336 } 337 338 $params['id'] = $slot['id']; 339 } 324 340 } 325 341
Note: See TracChangeset
for help on using the changeset viewer.