Code Duplication    Length = 19-19 lines in 2 locations

programs/vacadm.php 2 locations

@@ 685-703 (lines=19) @@
682
 *
683
 * @param int $vtid
684
 */
685
function deleteVacationType($vtid)
686
	{
687
	global $babBody, $babDB;
688
	$bdel = true;
689
690
	list($total) = $babDB->db_fetch_array($babDB->db_query("select count(id) as total from ".ABSENCES_RIGHTS_TBL." where id_type='".$babDB->db_escape_string($vtid)."'"));
691
	if( $total > 0 )
692
	{
693
		$bdel = false;
694
	}
695
696
	if( $bdel )
697
		{
698
		$babDB->db_query("delete from ".ABSENCES_TYPES_TBL." where id='".$babDB->db_escape_string($vtid)."'");
699
		$babDB->db_query("delete from ".ABSENCES_COLL_TYPES_TBL." where id_type='".$babDB->db_escape_string($vtid)."'");
700
		}
701
	else
702
		$babBody->msgerror = absences_translate("This vacation type is used and can't be deleted") ." !";
703
	}
704
705
706
/**
@@ 896-914 (lines=19) @@
893
 *
894
 * @param int $vcid
895
 */
896
function absences_deleteVacationCollection($vcid)
897
	{
898
	global $babDB;
899
	$bdel = true;
900
901
	list($total) = $babDB->db_fetch_array($babDB->db_query("select count(id) as total from ".ABSENCES_PERSONNEL_TBL." where id_coll='".$babDB->db_escape_string($vcid)."'"));
902
	if( $total > 0 )
903
		{
904
		$bdel = false;
905
		}
906
907
	if( $bdel )
908
		{
909
		$babDB->db_query("delete from ".ABSENCES_COLLECTIONS_TBL." where id='".$babDB->db_escape_string($vcid)."'");
910
		$babDB->db_query("delete from ".ABSENCES_COLL_TYPES_TBL." where id_coll='".$babDB->db_escape_string($vcid)."'");
911
		}
912
	else
913
		$babBody->msgerror = absences_translate("This vacation collection is used and can't be deleted") ." !";
914
	}
915
916
917
/**