Ajout statut traité
This commit is contained in:
parent
28032ee53a
commit
3be4c739d5
@ -97,14 +97,19 @@ if($_POST['btnunfinalise']) {
|
||||
$status = '1';
|
||||
$updateStatus = true;
|
||||
}
|
||||
|
||||
if($_POST['btnprocess'] && $isAdmin) {
|
||||
$status = '3';
|
||||
$updateStatus = true;
|
||||
}
|
||||
// Escape string, mostly in case of quotes
|
||||
$d = $mysqli->real_escape_string(serialize($_POST));
|
||||
if(!$aid) {
|
||||
$query = "INSERT INTO submissions (uid, status, name, created, formdata,modified) values('$userid',$status,'$username',null,'".serialize($_POST)."',NOW())";
|
||||
$query = "INSERT INTO submissions (uid, status, name, created, formdata,modified) values('$userid',$status,'$username',null,'".$d."',NOW())";
|
||||
syslog(LOG_INFO, "Create entry by uid: $userid / $uname from: {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
|
||||
|
||||
}
|
||||
else {
|
||||
$query = "UPDATE submissions set modifieduid=$userid,formdata='".serialize($_POST)."'";
|
||||
$query = "UPDATE submissions set modifieduid=$userid,formdata='".$d."'";
|
||||
if($updateStatus) {
|
||||
$query .= ",status=$status ";
|
||||
}
|
||||
@ -113,7 +118,7 @@ else {
|
||||
$query .= " AND uid=$userid";
|
||||
}
|
||||
syslog(LOG_INFO, "Update entry aid:$aid by uid: $userid / $uname from: {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
|
||||
$logquery = "INSERT INTO log (uid,aid,name,isadmin,operation,new,prev) SELECT '$userid',$aid,'$username', $isAdmin, 'update','".serialize($_POST)."', formdata FROM submissions WHERE ID=$aid";
|
||||
$logquery = "INSERT INTO log (uid,aid,name,isadmin,operation,new,prev) SELECT '$userid',$aid,'$username', $isAdmin, 'update','".$d."', formdata FROM submissions WHERE ID=$aid";
|
||||
}
|
||||
$mysqli->query($logquery);
|
||||
if (!$mysqli->query($query) ) {
|
||||
@ -145,7 +150,7 @@ die();
|
||||
syslog(LOG_INFO, "Load entry aid:$aid by uid: $userid / $uname from: {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
|
||||
$ar = unserialize($row['formdata']);
|
||||
// Return to list if we are not admin and trying to edit a finalised form. Shame on us
|
||||
if(!$isAdmin && $row['status']==0) {
|
||||
if(!$isAdmin && $row['status']!=1) {
|
||||
header("location: accred_list");
|
||||
die();
|
||||
}
|
||||
@ -407,8 +412,12 @@ die();
|
||||
if($row['status']==1) {
|
||||
$form->add('submit', 'btnfinalise', 'Enregistrer et Finaliser');
|
||||
}
|
||||
if($row['status']==0 && $isAdmin) {
|
||||
$form->add('submit', 'btnprocess', 'Marquer comme traité');
|
||||
}
|
||||
|
||||
// Admins can un-finalise
|
||||
if($isAdmin && $row['status']==0) {
|
||||
if($isAdmin && $row['status']==0 && $aid) {
|
||||
$form->add('submit', 'btnunfinalise', 'Enregistrer et rendre éditable');
|
||||
}
|
||||
// $form->add('submit', 'btncancel', 'Annuler');
|
||||
|
||||
@ -63,7 +63,7 @@ if ($mysqli->connect_errno) {
|
||||
}
|
||||
// Now remove unwanted columns
|
||||
foreach($master_array as $key => $val ) {
|
||||
if(!($key=='UID' || $key=='modifieduid' || $key=='btnsubmit' || $key=='btnfinalise' || $key=='formdata' || $key=='name_form')) {
|
||||
if(!($key=='UID' || $key=='modifieduid' || $key=='btnsubmit' || $key=='btnfinalise' || $key=='btnprocess' || $key=='formdata' || $key=='name_form')) {
|
||||
$header[$key] = $key;
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,19 @@ $line = 1;
|
||||
unset($fr);
|
||||
foreach($header as $key => $val) {
|
||||
if($key=='status') {
|
||||
$fr[$key] = $or[$key]==0 ? 'Finalisé' : 'Ouvert';
|
||||
$disp = 'Indéfini';
|
||||
switch($or[$key]) {
|
||||
case 0:
|
||||
$disp = 'Finalisé';
|
||||
break;
|
||||
case 1:
|
||||
$disp = 'Ouvert';
|
||||
break;
|
||||
case 2:
|
||||
$disp = 'Traité';
|
||||
break;
|
||||
}
|
||||
$fr[$key] = $disp;
|
||||
}
|
||||
else {
|
||||
$fr[$key] = $or[$key];
|
||||
@ -131,7 +143,19 @@ $line = 1;
|
||||
unset($fr);
|
||||
foreach($header as $key => $val) {
|
||||
if($key=='status') {
|
||||
$fr[$key] = $or[$key]==0 ? 'Finalisé' : 'Ouvert';
|
||||
$disp = 'Indéfini';
|
||||
switch($or[$key]) {
|
||||
case 0:
|
||||
$disp = 'Finalisé';
|
||||
break;
|
||||
case 1:
|
||||
$disp = 'Ouvert';
|
||||
break;
|
||||
case 2:
|
||||
$disp = 'Traité';
|
||||
break;
|
||||
}
|
||||
$fr[$key] = $disp;
|
||||
}
|
||||
else {
|
||||
$fr[$key] = $or[$key];
|
||||
@ -325,6 +349,9 @@ $(document).ready(function(){
|
||||
case "1":
|
||||
$(td).addClass('bck-edit editable');
|
||||
break;
|
||||
case "2":
|
||||
$(td).addClass('bck-processed');
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ color: #e50350;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.bck-edit:before, .bck-check:before {
|
||||
.bck-edit:before, .bck-check:before, .bck-processed:before {
|
||||
position : absolute;
|
||||
opacity : 0;
|
||||
}
|
||||
@ -46,6 +46,9 @@ color: #e50350;
|
||||
.editable:before {
|
||||
content : "Clique ici pour editer cette commande";
|
||||
}
|
||||
.bck-processed:before {
|
||||
content: "Cette commande a été traitée"
|
||||
}
|
||||
.user .bck-check:before {
|
||||
content: "Cette demande a été finalisée et ne peut plus être modifiée";
|
||||
}
|
||||
@ -53,7 +56,7 @@ color: #e50350;
|
||||
opacity : 1;
|
||||
}
|
||||
|
||||
.editable:hover:before, .bck-check:hover:before {
|
||||
.editable:hover:before, .bck-check:hover:before, .bck-processed:hover:before {
|
||||
opacity : 1;
|
||||
|
||||
background-color:#999; color: White;
|
||||
@ -68,6 +71,12 @@ background-color:#999; color: White;
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
}
|
||||
.bck-processed {
|
||||
|
||||
background-image: url("processed-icon.png");
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
td.details-control {
|
||||
background: url('details_open.png') no-repeat center center;
|
||||
cursor: pointer;
|
||||
|
||||
@ -69,4 +69,5 @@
|
||||
<div class="clear" style="margin-bottom:10px"></div>
|
||||
</div>
|
||||
<div class="row last"><?php echo $btnsubmit?> <?php echo $btnfinalise?> <?php echo $btnunfinalise?><div class="right-blob"><?php echo $btncancel?> </div><div class="right-blob"><?php echo $btndelete;?></div>
|
||||
<div><br><?php echo $btnprocess?></div>
|
||||
</div>
|
||||
|
||||
BIN
processed-icon.png
Normal file
BIN
processed-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@ -21,7 +21,7 @@ die();
|
||||
$id_token = $_POST['idtoken'];
|
||||
|
||||
$admins = array('106388451999977183087' => 'Y', // Jess
|
||||
'113391142723644034553' => 'Y' // Lars
|
||||
'113391142723644034553x' => 'Y' // Lars
|
||||
|
||||
);
|
||||
$client = new Google_Client(['client_id' => '538635499162-g21v86gk87qm863u03er6vnm3q15bl82.apps.googleusercontent.com']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user