Changeset 5977
- Timestamp:
- 04/19/12 17:54:45 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r5906 r5977 198 198 } 199 199 200 $filter = array('AND', array('=', 'folderName', $folder), array('IN','messageNumber', $sort_array_msg [0]));200 $filter = array('AND', array('=', 'folderName', $folder), array('IN','messageNumber', $sort_array_msg)); 201 201 $followupflagged = Controller::find( 202 202 array('concept' => 'followupflagged'), -
trunk/prototype/modules/mail/interceptors/Helpers.php
r5972 r5977 66 66 else 67 67 $criteria['filter'] = $filter; 68 } 69 } 70 71 //label:before.create 72 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.'); 68 77 } 69 78 } … … 127 136 128 137 $imap_result = Controller::find( 129 array('concept' => ' followupflagged'),138 array('concept' => 'message'), 130 139 array('messageId'), 131 140 array('filter' => $filter) 132 141 ); 133 142 134 143 if($imap_result) { 135 144 $params['messageId'] = $imap_result['messageId']; … … 139 148 $filter = array('=', 'messageId', $params['messageId']); 140 149 Controller::delete(array('concept' => 'followupflagged', 'service' => 'PostgreSQL'), null, $filter); 150 141 151 } 142 152 … … 232 242 $imap_uri = $uri; 233 243 $imap_uri['service'] = 'Imap'; 234 $imap_result = Controller::find($imap_uri, false, $original['criteria']); 244 $imap_criteria = $original['criteria']; 245 246 if (self::in_arrayr('alarmDeadline', $original['criteria']) || self::in_arrayr('doneDeadline', $original['criteria'])) { 247 if (empty($result)) return $reult; 248 249 $idList = array(); 250 foreach($result as $r) { 251 $idList[] = $r['messageId']; 252 } 253 254 $imap_criteria['filter'] = array('IN', 'messageId', $idList); 255 } 256 $imap_result = Controller::find($imap_uri, false, $imap_criteria); 235 257 236 258 /** … … 241 263 242 264 foreach($result as $k => $r) { 265 243 266 if ($r['messageId'] == $ir['messageId']) { 244 267 $merge_result[] = $r + $ir; 268 245 269 unset($result[$k]); 270 unset($imap_result[$j]); 271 246 272 break; 247 273 } 248 274 } 249 250 unset($imap_result[$j]);251 275 } 252 276 … … 272 296 $n['backgroundColor'] = '#FF2016'; 273 297 $n['id'] = Controller::create(array('concept' => 'followupflagged'), $n); 274 $merge_result[] = $ ir + $n;275 } 276 } 277 298 $merge_result[] = $n; 299 } 300 } 301 278 302 return $merge_result; 279 303 } … … 298 322 } 299 323 300 //label:before.create301 public function validateLabel(&$uri , &$params , &$criteria , $original){302 303 if( !!Controller::find( array('concept' => 'label'), false, array('filter' => array('i=', 'name', $params['name'])) ) )304 {305 throw new Exception('Já existe um marcador com esse nome.');306 }307 308 $used = Controller::service('PostgreSQL')->execSql( 'SELECT count(slot) as used from expressomail_label where user_id = '.Config::me('uidNumber'), true );309 310 if( $used['used'] === '0' )311 {312 $params['id'] = '1';313 return;314 }315 316 $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 );317 318 if( empty( $slot ) )319 {320 throw new Exception('Nenhum slot disponivel.');321 }322 323 $params['id'] = $slot['id'];324 }325 324 } 326 325
Note: See TracChangeset
for help on using the changeset viewer.