Changeset 5971 for trunk/prototype/modules/mail
- Timestamp:
- 04/18/12 18:19:41 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/mail/interceptors/Helpers.php
r5970 r5971 68 68 } 69 69 } 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 70 80 71 public static function in_arrayr($needle, $haystack) { … … 249 240 } 250 241 242 //label:before.create 243 public function validateLabel(&$uri , &$params , &$criteria , $original){ 244 245 if( !!Controller::find( array('concept' => 'label'), false, array('filter' => array('i=', 'name', $params['name'])) ) ) 246 { 247 throw new Exception('Já existe um marcador com esse nome.'); 248 } 249 250 $used = Controller::service('PostgreSQL')->execSql( 'SELECT count(slot) as used from expressomail_label where user_id = '.Config::me('uidNumber'), true ); 251 252 if( $used['used'] === '0' ) 253 { 254 $params['id'] = '1'; 255 return; 256 } 257 258 $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 ); 259 260 if( empty( $slot ) ) 261 { 262 throw new Exception('Nenhum slot disponivel.'); 263 } 264 265 $params['id'] = $slot['id']; 266 } 251 267 } 252 268
Note: See TracChangeset
for help on using the changeset viewer.