Ajout statut traité
This commit is contained in:
parent
28032ee53a
commit
3be4c739d5
@ -97,14 +97,19 @@ if($_POST['btnunfinalise']) {
|
|||||||
$status = '1';
|
$status = '1';
|
||||||
$updateStatus = true;
|
$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) {
|
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']})");
|
syslog(LOG_INFO, "Create entry by uid: $userid / $uname from: {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$query = "UPDATE submissions set modifieduid=$userid,formdata='".serialize($_POST)."'";
|
$query = "UPDATE submissions set modifieduid=$userid,formdata='".$d."'";
|
||||||
if($updateStatus) {
|
if($updateStatus) {
|
||||||
$query .= ",status=$status ";
|
$query .= ",status=$status ";
|
||||||
}
|
}
|
||||||
@ -113,7 +118,7 @@ else {
|
|||||||
$query .= " AND uid=$userid";
|
$query .= " AND uid=$userid";
|
||||||
}
|
}
|
||||||
syslog(LOG_INFO, "Update entry aid:$aid by uid: $userid / $uname from: {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
|
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);
|
$mysqli->query($logquery);
|
||||||
if (!$mysqli->query($query) ) {
|
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']})");
|
syslog(LOG_INFO, "Load entry aid:$aid by uid: $userid / $uname from: {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
|
||||||
$ar = unserialize($row['formdata']);
|
$ar = unserialize($row['formdata']);
|
||||||
// Return to list if we are not admin and trying to edit a finalised form. Shame on us
|
// 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");
|
header("location: accred_list");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
@ -407,8 +412,12 @@ die();
|
|||||||
if($row['status']==1) {
|
if($row['status']==1) {
|
||||||
$form->add('submit', 'btnfinalise', 'Enregistrer et Finaliser');
|
$form->add('submit', 'btnfinalise', 'Enregistrer et Finaliser');
|
||||||
}
|
}
|
||||||
|
if($row['status']==0 && $isAdmin) {
|
||||||
|
$form->add('submit', 'btnprocess', 'Marquer comme traité');
|
||||||
|
}
|
||||||
|
|
||||||
// Admins can un-finalise
|
// 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', 'btnunfinalise', 'Enregistrer et rendre éditable');
|
||||||
}
|
}
|
||||||
// $form->add('submit', 'btncancel', 'Annuler');
|
// $form->add('submit', 'btncancel', 'Annuler');
|
||||||
|
|||||||
@ -63,7 +63,7 @@ if ($mysqli->connect_errno) {
|
|||||||
}
|
}
|
||||||
// Now remove unwanted columns
|
// Now remove unwanted columns
|
||||||
foreach($master_array as $key => $val ) {
|
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;
|
$header[$key] = $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,19 @@ $line = 1;
|
|||||||
unset($fr);
|
unset($fr);
|
||||||
foreach($header as $key => $val) {
|
foreach($header as $key => $val) {
|
||||||
if($key=='status') {
|
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 {
|
else {
|
||||||
$fr[$key] = $or[$key];
|
$fr[$key] = $or[$key];
|
||||||
@ -131,7 +143,19 @@ $line = 1;
|
|||||||
unset($fr);
|
unset($fr);
|
||||||
foreach($header as $key => $val) {
|
foreach($header as $key => $val) {
|
||||||
if($key=='status') {
|
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 {
|
else {
|
||||||
$fr[$key] = $or[$key];
|
$fr[$key] = $or[$key];
|
||||||
@ -325,6 +349,9 @@ $(document).ready(function(){
|
|||||||
case "1":
|
case "1":
|
||||||
$(td).addClass('bck-edit editable');
|
$(td).addClass('bck-edit editable');
|
||||||
break;
|
break;
|
||||||
|
case "2":
|
||||||
|
$(td).addClass('bck-processed');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,13 +32,13 @@ color: #e50350;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.bck-check {
|
.bck-check {
|
||||||
|
|
||||||
background-image: url("sign-check-icon.png");
|
background-image: url("sign-check-icon.png");
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.bck-edit:before, .bck-check:before {
|
.bck-edit:before, .bck-check:before, .bck-processed:before {
|
||||||
position : absolute;
|
position : absolute;
|
||||||
opacity : 0;
|
opacity : 0;
|
||||||
}
|
}
|
||||||
@ -46,6 +46,9 @@ color: #e50350;
|
|||||||
.editable:before {
|
.editable:before {
|
||||||
content : "Clique ici pour editer cette commande";
|
content : "Clique ici pour editer cette commande";
|
||||||
}
|
}
|
||||||
|
.bck-processed:before {
|
||||||
|
content: "Cette commande a été traitée"
|
||||||
|
}
|
||||||
.user .bck-check:before {
|
.user .bck-check:before {
|
||||||
content: "Cette demande a été finalisée et ne peut plus être modifiée";
|
content: "Cette demande a été finalisée et ne peut plus être modifiée";
|
||||||
}
|
}
|
||||||
@ -53,7 +56,7 @@ color: #e50350;
|
|||||||
opacity : 1;
|
opacity : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable:hover:before, .bck-check:hover:before {
|
.editable:hover:before, .bck-check:hover:before, .bck-processed:hover:before {
|
||||||
opacity : 1;
|
opacity : 1;
|
||||||
|
|
||||||
background-color:#999; color: White;
|
background-color:#999; color: White;
|
||||||
@ -68,6 +71,12 @@ background-color:#999; color: White;
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.bck-processed {
|
||||||
|
|
||||||
|
background-image: url("processed-icon.png");
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
td.details-control {
|
td.details-control {
|
||||||
background: url('details_open.png') no-repeat center center;
|
background: url('details_open.png') no-repeat center center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@ -69,4 +69,5 @@
|
|||||||
<div class="clear" style="margin-bottom:10px"></div>
|
<div class="clear" style="margin-bottom:10px"></div>
|
||||||
</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 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>
|
</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'];
|
$id_token = $_POST['idtoken'];
|
||||||
|
|
||||||
$admins = array('106388451999977183087' => 'Y', // Jess
|
$admins = array('106388451999977183087' => 'Y', // Jess
|
||||||
'113391142723644034553' => 'Y' // Lars
|
'113391142723644034553x' => 'Y' // Lars
|
||||||
|
|
||||||
);
|
);
|
||||||
$client = new Google_Client(['client_id' => '538635499162-g21v86gk87qm863u03er6vnm3q15bl82.apps.googleusercontent.com']);
|
$client = new Google_Client(['client_id' => '538635499162-g21v86gk87qm863u03er6vnm3q15bl82.apps.googleusercontent.com']);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user