Code Duplication    Length = 39-43 lines in 2 locations

programs/vacuser.php 2 locations

@@ 3021-3059 (lines=39) @@
3018
		// request modification
3019
		
3020
		
3021
		if (bab_rp('rfrom'))
3022
		{
3023
			if ($agent->isManager() && !bab_rp('ide'))
3024
			{
3025
				// request modification from a manager
3026
			
3027
				$babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu");
3028
				$babBody->addItemMenu("lper", absences_translate("Requests"), absences_addon()->getUrl()."vacadmb&idx=lreq");
3029
				$babBody->addItemMenu("period", absences_translate("Edit"), absences_addon()->getUrl()."vacuser&idx=period");
3030
			}
3031
			
3032
			if ($agent->isEntityManager() && bab_rp('ide'))
3033
			{
3034
				// request modification from a delegated manager
3035
			
3036
				$babBody->addItemMenu("entities", absences_translate("Delegated management"), absences_addon()->getUrl()."vacchart&idx=entities");
3037
				$babBody->addItemMenu("entity_members", absences_translate("Entity requests"), absences_addon()->getUrl()."vacchart&idx=entity_requests&ide=".bab_rp('ide'));
3038
				$babBody->addItemMenu("period", absences_translate("Edit"), absences_addon()->getUrl()."vacuser&idx=period&ide=".bab_rp('ide'));
3039
			}
3040
			
3041
			
3042
		} else {
3043
			
3044
			// request modification from agent
3045
		
3046
			$babBody->addItemMenu("lvreq", absences_translate("Requests"), absences_addon()->getUrl()."vacuser&idx=lvreq");
3047
			$babBody->addItemMenu("period", absences_translate("Edit"), absences_addon()->getUrl()."vacuser&idx=period&id=".bab_rp('id'));
3048
			
3049
			if( $agent->isManager())
3050
			{
3051
				$babBody->addItemMenu("list", absences_translate("Management"), absences_addon()->getUrl()."vacadm");
3052
			}
3053
			if ($agent->isEntityManager())
3054
			{
3055
				$babBody->addItemMenu("entities", absences_translate("Delegate management"), absences_addon()->getUrl()."vacchart&idx=entities");
3056
			}
3057
		
3058
		
3059
		}
3060
		
3061
		
3062
		$babBody->setTitle(absences_translate("Edit vacation request"));
@@ 3092-3134 (lines=43) @@
3089
		if (isset($_GET['idu']) && is_numeric($_GET['idu'])) {
3090
			$id_user = $_GET['idu']; // deprecated?
3091
		}
3092
		else {
3093
			$id_user = bab_rp('id_user', bab_getUserId());
3094
			
3095
			if (bab_rp('rfrom'))
3096
			{
3097
			
3098
				if ($agent->isManager() && !bab_rp('ide'))
3099
				{
3100
					// request creation from a manager
3101
					
3102
					$babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu");
3103
					$babBody->addItemMenu("lper", absences_translate("Personnel"), absences_addon()->getUrl()."vacadm&idx=lper");
3104
					$babBody->addItemMenu("period", absences_translate("Request"), absences_addon()->getUrl()."vacuser&idx=period");
3105
				}
3106
				
3107
				if ($agent->isEntityManager() && bab_rp('ide'))
3108
				{
3109
					// request creation from a delegated manager
3110
					
3111
					$babBody->addItemMenu("entities", absences_translate("Delegated management"), absences_addon()->getUrl()."vacchart&idx=entities");
3112
					$babBody->addItemMenu("entity_members", absences_translate("Entity members"), absences_addon()->getUrl()."vacchart&idx=entity_members&ide=".bab_rp('ide'));
3113
					$babBody->addItemMenu("period", absences_translate("Request"), absences_addon()->getUrl()."vacuser&idx=period");
3114
				}
3115
			
3116
			} else {
3117
				
3118
				// request creation from agent
3119
				
3120
				$babBody->addItemMenu("lvreq", absences_translate("Requests"), absences_addon()->getUrl()."vacuser&idx=lvreq");
3121
				$babBody->addItemMenu("period", absences_translate("Request"), absences_addon()->getUrl()."vacuser&idx=period");
3122
				
3123
				
3124
				if( $agent->isManager())
3125
				{
3126
					$babBody->addItemMenu("list", absences_translate("Management"), absences_addon()->getUrl()."vacadm");
3127
				}
3128
				if ($agent->isEntityManager())
3129
				{
3130
					$babBody->addItemMenu("entities", absences_translate("Delegate management"), absences_addon()->getUrl()."vacchart&idx=entities");
3131
				}
3132
				
3133
			}
3134
		}
3135
		
3136
		
3137
		if ($id_user == bab_getUserId())