Add requisition date field in HR ticket
This commit is contained in:
@ -91,6 +91,8 @@
|
||||
|
||||
$isBLMP = false;
|
||||
|
||||
$requisition_date = "";
|
||||
|
||||
|
||||
|
||||
$last_generated_Sequence_bl = last_generated_Sequence('bon de livraison ac')+1 ;
|
||||
@ -111,54 +113,27 @@
|
||||
|
||||
case 0: //BULLETIN DE SORTIE
|
||||
|
||||
|
||||
|
||||
// Get the submitted date
|
||||
|
||||
$bs_date_sortir = $_POST['bs_date_sortir'];
|
||||
|
||||
|
||||
|
||||
// Get the current date in 'Y-m-d' format
|
||||
|
||||
$current_date = date('Y-m-d');
|
||||
|
||||
|
||||
|
||||
if ($bs_date_sortir < $current_date) {
|
||||
|
||||
|
||||
|
||||
$_SESSION["bs_date_sortir"] = $bs_date_sortir;
|
||||
|
||||
|
||||
|
||||
Session::addMessageAfterRedirect(__('VOUS N\'ETES PAS PERMIS'),false, ERROR);
|
||||
|
||||
|
||||
|
||||
echo json_encode([
|
||||
|
||||
'is_valid' => false,
|
||||
|
||||
'modele' => $_SESSION['modele']
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($_SESSION["bs_date_sortir"]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$name = "Bulletin de sortie";
|
||||
|
||||
$table='<table style="height: 136px; width: 100%; border-collapse: collapse;" border="1" cellpadding="5"><tbody><tr style="height: 17px;"><td style="width: 49.1195%; height: 17px;"><strong>
|
||||
@ -175,9 +150,7 @@
|
||||
|
||||
Pour affaire Personnelle :</strong></td><td style="width: 50.8805%; height: 17px;">'.$_POST['bs_affaire_personnelle'].'</td></tr></tbody></table>';
|
||||
|
||||
|
||||
|
||||
|
||||
$requisition_date = $_POST['bs_date_sortir'];
|
||||
|
||||
break;
|
||||
|
||||
@ -268,24 +241,17 @@
|
||||
|
||||
Adresse durant le Congé :</strong></td><td style="width: 60.624%; height: 17px;"> '.$_POST['dc_adresse'].'</td></tr></tbody></table>';
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 3://Autorisation d'absence
|
||||
|
||||
|
||||
|
||||
// Get the submitted date
|
||||
|
||||
$aa_date_absenter = $_POST['aa_date_absenter'];
|
||||
|
||||
|
||||
|
||||
// Get the current date in 'Y-m-d' format
|
||||
|
||||
$current_date = date('Y-m-d');
|
||||
|
||||
|
||||
|
||||
if ($aa_date_absenter < $current_date) {
|
||||
|
||||
|
||||
@ -312,66 +278,42 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($_SESSION["aa_date_absenter"]);
|
||||
|
||||
|
||||
|
||||
$name = "Autorisation d'absence";
|
||||
|
||||
$table ='Matricule : '.$_POST['matricule'].'<br>Fonction : '.$_POST['fonction'].'<br> Structure : '.$_POST['structure'].'
|
||||
|
||||
<br> Est autorisé (e) à s'absenter la journée du : '.$_POST['aa_date_absenter'].'<br> Commentaire : '.$_POST['aa_commentaire'].'';
|
||||
|
||||
break;
|
||||
$requisition_date = $_POST['aa_date_absenter'];
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 4://AUTORISATION D'ENTREE
|
||||
|
||||
|
||||
case 4://AUTORISATION D'ENTREE
|
||||
|
||||
// Get the submitted date
|
||||
|
||||
$ae_date_reprendre = $_POST['ae_date_reprendre'];
|
||||
|
||||
|
||||
|
||||
// Get the current date in 'Y-m-d' format
|
||||
|
||||
$current_date = date('Y-m-d');
|
||||
|
||||
|
||||
|
||||
if ($ae_date_reprendre < $current_date) {
|
||||
|
||||
|
||||
|
||||
$_SESSION["ae_date_reprendre"] = $ae_date_reprendre;
|
||||
|
||||
|
||||
|
||||
Session::addMessageAfterRedirect(__('VOUS N\'ETES PAS PERMIS'),false, ERROR);
|
||||
|
||||
|
||||
|
||||
echo json_encode([
|
||||
|
||||
'is_valid' => false,
|
||||
|
||||
'modele' => $_SESSION['modele']
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($_SESSION["ae_date_reprendre"]);
|
||||
|
||||
|
||||
@ -382,17 +324,19 @@
|
||||
|
||||
<br>Est autorisé (e) de reprendre à : '.$_POST['ae_date_reprendre'].'<br> Commentaire : '.$_POST['ae_commentaire'];
|
||||
|
||||
break;
|
||||
$requisition_date = $_POST['ae_date_reprendre'];
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 5://DEMANDE DE RECRUTEMENT
|
||||
case 5://DEMANDE DE RECRUTEMENT
|
||||
|
||||
$name = "DEMANDE DE RECRUTEMENT";
|
||||
|
||||
$table ='matricule : '.$_POST['matricule'].'<br>fonction : '.$_POST['fonction'].'<br>structure : '.$_POST['structure'].'<br><br>description : '.$_POST['description'];
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -401,22 +345,12 @@
|
||||
|
||||
|
||||
// Get the submitted date
|
||||
|
||||
$date_req = $_POST['date_req'];
|
||||
|
||||
|
||||
|
||||
|
||||
// Get the current date in 'Y-m-d' format
|
||||
$current_date = date('Y-m-d');
|
||||
|
||||
|
||||
|
||||
// Calculate the date two days ago from today
|
||||
|
||||
$two_days_ago = date('Y-m-d', strtotime('-2 days', strtotime($current_date)));
|
||||
|
||||
|
||||
|
||||
if ($date_req < $two_days_ago) {
|
||||
if ($date_req < $current_date) {
|
||||
|
||||
|
||||
|
||||
@ -430,28 +364,18 @@
|
||||
|
||||
$_SESSION["lieu_de_travail"] = $_POST['lieu_de_travail'];
|
||||
|
||||
|
||||
|
||||
Session::addMessageAfterRedirect(__('VOUS N\'ETES PAS PERMIS'),false, ERROR);
|
||||
|
||||
|
||||
|
||||
echo json_encode([
|
||||
|
||||
'is_valid' => false,
|
||||
|
||||
'modele' => $_SESSION['modele']
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($_SESSION["date_req"]);
|
||||
|
||||
unset($_SESSION["mot_req"]);
|
||||
@ -464,10 +388,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$name = "HEURES SUPPLEMENTAIRES";
|
||||
|
||||
$table ='matricule : '.$_POST['matricule'].'<br>fonction : '.$_POST['fonction'].'<br>structure : '.$_POST['structure'].'<br>
|
||||
@ -476,9 +396,9 @@
|
||||
|
||||
<br>Heure de fin : '.$_POST['heure_f'].'<br>Lieu de travail : '.$_POST['lieu_de_travail'];
|
||||
|
||||
break;
|
||||
$requisition_date = $_POST['date_req'];
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 7://DEMANDE ORDRE DE MISSION
|
||||
|
||||
@ -496,32 +416,21 @@
|
||||
|
||||
case 8://CONGE DE RECUPERATION
|
||||
|
||||
|
||||
|
||||
$cr_date_debut = $_POST['cr_date_debut'];
|
||||
|
||||
$cr_date_fin = $_POST['cr_date_fin'];
|
||||
|
||||
|
||||
|
||||
$current_date = date('Y-m-d');
|
||||
|
||||
|
||||
|
||||
if ($cr_date_debut < $current_date || $cr_date_fin < $cr_date_debut) {
|
||||
|
||||
|
||||
|
||||
$_SESSION["cr_date_debut"] = $cr_date_debut;
|
||||
|
||||
$_SESSION["cr_date_fin"] = $cr_date_fin;
|
||||
|
||||
|
||||
|
||||
Session::addMessageAfterRedirect(__('VOUS N\'ETES PAS PERMIS'),false, ERROR);
|
||||
|
||||
|
||||
|
||||
echo json_encode([
|
||||
|
||||
'is_valid' => false,
|
||||
@ -529,21 +438,12 @@
|
||||
'modele' => $_SESSION['modele']
|
||||
|
||||
]);
|
||||
|
||||
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($_SESSION["cr_date_debut"]);
|
||||
|
||||
unset($_SESSION["cr_date_fin"]);
|
||||
|
||||
|
||||
|
||||
$name = "CONGE DE RECUPERATION";
|
||||
|
||||
|
||||
@ -558,6 +458,8 @@
|
||||
if(isset($_POST['cr_date_4']) && $_POST['cr_date_4'] != '') $table = $table.",".$_POST['cr_date_4'];
|
||||
if(isset($_POST['cr_date_5']) && $_POST['cr_date_5'] != '') $table = $table.",".$_POST['cr_date_5'];
|
||||
if(isset($_POST['cr_date_6']) && $_POST['cr_date_6'] != '') $table = $table.",".$_POST['cr_date_6'];
|
||||
|
||||
$requisition_date = $_POST['cr_date_debut'];
|
||||
|
||||
break;
|
||||
|
||||
@ -579,9 +481,9 @@
|
||||
|
||||
$isWorkOrder = true;
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
case 10:
|
||||
|
||||
$isBLAC = true;
|
||||
|
||||
@ -609,9 +511,9 @@
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
case 11:
|
||||
|
||||
$name = "Demande de congé statutaire";
|
||||
|
||||
@ -631,39 +533,39 @@
|
||||
|
||||
Intérimaire :</strong></td><td style="width: 60.624%; height: 17px;"> '.$_POST['dcs_interimaire'].'</td></tr><tr style="height: 17px;"><td style="width: 39.376%; height: 17px;"><strong>';
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
case 12:
|
||||
|
||||
$isBCPROD = true;
|
||||
$isBCPROD = true;
|
||||
|
||||
$name = "Production : Bon De Commande";
|
||||
$name = "Production : Bon De Commande";
|
||||
|
||||
$table ='matricule : '.$_POST['matricule'].'<br>fonction : '.$_POST['fonction'].'<br>structure : '.$_POST['structure'].'<br>'.'
|
||||
$table ='matricule : '.$_POST['matricule'].'<br>fonction : '.$_POST['fonction'].'<br>structure : '.$_POST['structure'].'<br>'.'
|
||||
|
||||
<br>N° de Piece : BC PROD'.str_pad($last_generated_Sequence_bc , 6, '0', STR_PAD_LEFT).'/'.(date("y")).'<br>Hangar : '.$_POST['acbc_reference'].'<br><br>';
|
||||
<br>N° de Piece : BC PROD'.str_pad($last_generated_Sequence_bc , 6, '0', STR_PAD_LEFT).'/'.(date("y")).'<br>Hangar : '.$_POST['acbc_reference'].'<br><br>';
|
||||
|
||||
$nbr = count($_POST["designation"]);
|
||||
$nbr = count($_POST["designation"]);
|
||||
|
||||
for($i=0;$i < $nbr ;$i++){
|
||||
for($i=0;$i < $nbr ;$i++){
|
||||
|
||||
$table = $table.' '.$_POST['type'][$i].': <br> Désignation : '.
|
||||
$table = $table.' '.$_POST['type'][$i].': <br> Désignation : '.
|
||||
|
||||
$_POST['designation'][$i].'<br> N° Lot : '.
|
||||
$_POST['designation'][$i].'<br> N° Lot : '.
|
||||
|
||||
$_POST['lot'][$i].'<br> Quantité Livrée : '.
|
||||
$_POST['lot'][$i].'<br> Quantité Livrée : '.
|
||||
|
||||
$_POST['quantite'][$i].' <br> Observations : '.
|
||||
$_POST['quantite'][$i].' <br> Observations : '.
|
||||
|
||||
$_POST['obs'][$i].' <br> '.
|
||||
$_POST['obs'][$i].' <br> '.
|
||||
|
||||
'<br>';
|
||||
'<br>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
case 13:
|
||||
|
||||
$isBLMP = true;
|
||||
|
||||
@ -691,8 +593,9 @@
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case 14:
|
||||
break;
|
||||
|
||||
case 14:
|
||||
// Get the submitted data
|
||||
$ap_date = $_POST['ap_date'];
|
||||
$ap_start_time = $_POST['ap_start_time'];
|
||||
@ -777,7 +680,9 @@
|
||||
$name = "Autorisation de paie";
|
||||
$table ='Matricule : '.$_POST['matricule'].'<br>Fonction : '.$_POST['fonction'].'<br>Structure : '.$_POST['structure'].'
|
||||
<br>Est autorise le : '.$_POST['ap_date'].'<br> Du : '.$_POST['ap_start_time'].'<br> a : '.$_POST['ap_end_time'];
|
||||
break;
|
||||
|
||||
$requisition_date = $_POST['ap_date'];
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@ -807,7 +712,7 @@
|
||||
|
||||
|
||||
|
||||
add_ticket($id_categorie[$name],$name,$table,$_SESSION["glpiID"]);
|
||||
add_ticket($id_categorie[$name],$name,$table,$_SESSION["glpiID"], $requisition_date);
|
||||
|
||||
$tickets_id = $DB->insert_id();
|
||||
|
||||
|
||||
@ -514,27 +514,37 @@
|
||||
|
||||
|
||||
|
||||
function add_ticket($id_categorie,$name,$table,$glpiID){
|
||||
function add_ticket($id_categorie, $name, $table, $glpiID, $requisition_date = null) {
|
||||
|
||||
global $DB;
|
||||
global $DB;
|
||||
|
||||
|
||||
if ($requisition_date) {
|
||||
// With requisition_date
|
||||
$stmt = $DB->prepare("
|
||||
INSERT INTO glpi_tickets
|
||||
(`date`, `type`, `itilcategories_id`, `entities_id`, `status`,
|
||||
`requesttypes_id`, `urgency`, `impact`, `locations_id`,
|
||||
`priority`, `name`, `content`, `id`, `users_id_lastupdater`,
|
||||
`users_id_recipient`, `global_validation`, `date_creation`, `date_mod`, `requisition_date`)
|
||||
VALUES (NOW(), '2', ?, '0', '1', '1', '3', '3', '0', '3', ?, ?, '0', ?, ?, '1', NOW(), NOW(), ?)
|
||||
");
|
||||
$stmt->bind_param("issiis", $id_categorie, $name, $table, $glpiID, $glpiID, $requisition_date);
|
||||
} else {
|
||||
// Without requisition_date
|
||||
$stmt = $DB->prepare("
|
||||
INSERT INTO glpi_tickets
|
||||
(`date`, `type`, `itilcategories_id`, `entities_id`, `status`,
|
||||
`requesttypes_id`, `urgency`, `impact`, `locations_id`,
|
||||
`priority`, `name`, `content`, `id`, `users_id_lastupdater`,
|
||||
`users_id_recipient`, `global_validation`, `date_creation`, `date_mod`)
|
||||
VALUES (NOW(), '2', ?, '0', '1', '1', '3', '3', '0', '3', ?, ?, '0', ?, ?, '1', NOW(), NOW())
|
||||
");
|
||||
$stmt->bind_param("issii", $id_categorie, $name, $table, $glpiID, $glpiID);
|
||||
}
|
||||
|
||||
$stmt = $DB->prepare("INSERT INTO `glpi_tickets` (`date`, `type`, `itilcategories_id`, `entities_id`, `status`,
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
`requesttypes_id`, `urgency`, `impact`, `locations_id`,
|
||||
|
||||
`priority`, `name`, `content`, `id`, `users_id_lastupdater`, `users_id_recipient`,
|
||||
|
||||
`global_validation`, `date_creation`, `date_mod`)
|
||||
|
||||
VALUES (NOW(), '2', ?, '0', '1', '1', '3', '3', '0', '3',?, ?, '0', ?, ?, '1', NOW(), NOW())");
|
||||
|
||||
$stmt->bind_param("issii" , $id_categorie,$name,$table,$glpiID,$glpiID );
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -690,7 +700,7 @@
|
||||
|
||||
|
||||
|
||||
function get_detail_ticket($id_ticket){
|
||||
function get_detail_ticket($id_ticket){
|
||||
|
||||
|
||||
|
||||
@ -959,7 +969,7 @@
|
||||
WHEN t.status = 2 THEN 'En cours'
|
||||
WHEN t.status = 3 THEN 'En cours'
|
||||
WHEN t.status = 4 THEN 'En attente'
|
||||
WHEN t.status = 5 THEN 'R<>solu'
|
||||
WHEN t.status = 5 THEN 'R<>solu'
|
||||
WHEN t.status = 6 THEN 'Clos'
|
||||
END AS status,
|
||||
t.name as ticket_name,
|
||||
@ -987,7 +997,7 @@
|
||||
WHEN t.status = 2 THEN 'En cours'
|
||||
WHEN t.status = 3 THEN 'En cours'
|
||||
WHEN t.status = 4 THEN 'En attente'
|
||||
WHEN t.status = 5 THEN 'R<>solu'
|
||||
WHEN t.status = 5 THEN 'R<>solu'
|
||||
WHEN t.status = 6 THEN 'Clos'
|
||||
END AS status,
|
||||
t.name as ticket_name,
|
||||
@ -1096,7 +1106,7 @@
|
||||
|
||||
|
||||
|
||||
// closing hr tickets after 2 days
|
||||
// closing hr tickets after 2 days
|
||||
function close_hr_tickets(){
|
||||
global $DB;
|
||||
$stmt = $DB->prepare("update glpi_tickets set status = 6 , closedate = now() where id in ( SELECT
|
||||
|
||||
Reference in New Issue
Block a user