Index: /trunk/admin/setup/phpgw_pt-br.lang
===================================================================
--- /trunk/admin/setup/phpgw_pt-br.lang	(revision 5875)
+++ /trunk/admin/setup/phpgw_pt-br.lang	(revision 5988)
@@ -563,2 +563,4 @@
 day(s)	admin	pt-br	dia(s)
 Number max of labels	admin	pt-br	Número máximo de marcadores
+There are users with an quantity greater than of markers. Respect the minimum number indicated.	admin	pt-br	Existem usuários com uma quantidade superior de marcadores. Respeito o número mínimo indicado.
+Minimum number of labels allowed	admin	pt-br	Número mínimo de marcadores permitido
Index: /trunk/admin/inc/class.uiconfig.inc.php
===================================================================
--- /trunk/admin/inc/class.uiconfig.inc.php	(revision 5875)
+++ /trunk/admin/inc/class.uiconfig.inc.php	(revision 5988)
@@ -334,7 +334,15 @@
 
 			$GLOBALS['phpgw']->hooks->single('config',$appname);
-
+			
 			/* Seta o valor padrão para a configuração de número máximo de marcadores */
 			$current_config['expressoMail_limit_labels'] = (isset($current_config['expressoMail_limit_labels']) && !!$current_config['expressoMail_limit_labels'] ) ? $current_config['expressoMail_limit_labels'] : 20;
+			/* Recupera o número mínimo de marcadores que pode ser definido */
+			$db = '';
+			$db = $db ? $db : $GLOBALS['phpgw']->db;	// this is to allow setup to set the db
+			$db->query("SELECT max(slot) as slot from expressomail_label",__LINE__,__FILE__);
+			while( $db->next_record() )
+			{
+				$cont_labels = $db->f('slot');
+			}
 
 			foreach($vars as $value)
@@ -410,4 +418,6 @@
 			}
 
+			$t->set_var('min_labels',$cont_labels);
+			
 			$t->pfp('out','body');
 
Index: /trunk/expressoMail1_2/templates/default/config.tpl
===================================================================
--- /trunk/expressoMail1_2/templates/default/config.tpl	(revision 5875)
+++ /trunk/expressoMail1_2/templates/default/config.tpl	(revision 5988)
@@ -27,4 +27,7 @@
     <td colspan="2"><font color="{th_text}">&nbsp;<b>{title}</b></font></td>
    </tr>
+	<tr bgcolor="{th_err}">
+		<td colspan="2"><b>{error}</b></td>
+	</tr>
 <!-- END header -->
 <!-- BEGIN body -->
@@ -160,5 +163,6 @@
 		<td>{lang_Number_max_of_labels}</td>
 		<td>
-		<input type="text" name="newsettings[expressoMail_limit_labels]" value="{value_expressoMail_limit_labels}" size="3" /> 
+		<input type="text" name="newsettings[expressoMail_limit_labels]" value="{value_expressoMail_limit_labels}" size="3" />
+		<span style="color: red;margin-left: 30px"> *{lang_Minimum number of labels allowed} {min_labels}</span>		
 		</td>
 	</tr>
Index: /trunk/expressoMail1_2/setup/default_records.inc.php
===================================================================
--- /trunk/expressoMail1_2/setup/default_records.inc.php	(revision 5982)
+++ /trunk/expressoMail1_2/setup/default_records.inc.php	(revision 5988)
@@ -11,4 +11,8 @@
 			/* Seta o valor padrão para a configuração de número máximo de marcadores */
 			$oProc->query("INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES ('expressoMail1_2', 'expressoMail_limit_labels', 20);");
+			
+			/* Registra o hook de validação do administrador*/
+			$oProc->query("INSERT INTO phpgw_hooks( \"hook_appname\", \"hook_location\", \"hook_filename\") VALUES ('expressoMail1_2', 'config_validate', 'hook_config_validate.inc.php')");
+
 		
 ?>
Index: /trunk/expressoMail1_2/setup/tables_update.inc.php
===================================================================
--- /trunk/expressoMail1_2/setup/tables_update.inc.php	(revision 5982)
+++ /trunk/expressoMail1_2/setup/tables_update.inc.php	(revision 5988)
@@ -196,7 +196,5 @@
 			$oProc->query("INSERT INTO expressomail_followupflag(name) VALUES ('Don''t forward');");
 			$oProc->query("INSERT INTO expressomail_followupflag(name) VALUES ('Don''t answer');");
-			
-			/* Seta o valor padrão para a configuração de número máximo de marcadores */
-			$oProc->query("INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES ('expressoMail1_2', 'expressoMail_limit_labels', 20);");
+
 						
 		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '2.4.1';
@@ -254,3 +252,15 @@
 	}
 	
+		$test[] = '2.4.5';
+	function expressoMail1_2_upgrade2_4_5() {
+		$oProc = $GLOBALS['phpgw_setup']->oProc;
+		/* Seta o valor padrão para a configuração de número máximo de marcadores */
+		$oProc->query("INSERT INTO phpgw_config(config_app, config_name, config_value) VALUES ('expressoMail1_2', 'expressoMail_limit_labels', 20);");
+		/* Registra o hook de validação do administrador*/
+		$oProc->query("INSERT INTO phpgw_hooks( \"hook_appname\", \"hook_location\", \"hook_filename\") VALUES ('expressoMail1_2', 'config_validate', 'hook_config_validate.inc.php')");
+
+	    $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '2.4.6';
+	    return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
+	}
+	
 ?>
Index: /trunk/expressoMail1_2/setup/setup.inc.php
===================================================================
--- /trunk/expressoMail1_2/setup/setup.inc.php	(revision 5981)
+++ /trunk/expressoMail1_2/setup/setup.inc.php	(revision 5988)
@@ -13,5 +13,5 @@
 $setup_info['expressoMail1_2']['name'] = 'expressoMail1_2';
 $setup_info['expressoMail1_2']['title'] = 'Expresso Mail';
-$setup_info['expressoMail1_2']['version'] = '2.4.5';
+$setup_info['expressoMail1_2']['version'] = '2.4.6';
 $setup_info['expressoMail1_2']['app_order'] = 2;
 $setup_info['expressoMail1_2']['tables'][] = 'phpgw_expressomail_contacts';
Index: /trunk/expressoMail1_2/inc/hook_config_validate.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/hook_config_validate.inc.php	(revision 5988)
+++ /trunk/expressoMail1_2/inc/hook_config_validate.inc.php	(revision 5988)
@@ -0,0 +1,21 @@
+<?php
+
+$GLOBALS['phpgw_info']['server']['found_validation_hook'] = True;
+
+function expressoMail_limit_labels($value){
+	$db = '';
+	$db = $db ? $db : $GLOBALS['phpgw']->db;	// this is to allow setup to set the db
+	$db->query("SELECT max(slot) as slot from expressomail_label",__LINE__,__FILE__);
+	while( $db->next_record() )
+	{
+		$slot = $db->f('slot');
+	}
+	if(isset($slot)){
+		if($value < $slot){
+			$GLOBALS['config_error'] = 'There are users with an quantity greater than of markers. Respect the minimum number indicated.';
+		}
+	}
+
+}
+
+?>
