-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.php
executable file
·226 lines (172 loc) · 6.79 KB
/
docs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
include 'checkUser.php';
if (!canEdit()){
header('Location: ./consult.php');
exit();
}
include 'connectionFactory.php';
$mysqli= ConnectionFactory::GetConnection();
$id=$_GET['id'];
$origin=$_GET['o'];
$query = 'SELECT
Reg_RecordType.Id,
Reg_RecordType.Name,
Reg_Status.Id,
Reg_Status.Name,
Reg_Individual.FirstName,
Reg_Individual.LastName,
Reg_Individual.Gender,
Reg_Individual.Citizenship,
Reg_Individual.BirthDate,
Reg_Individual.IdCard,
Reg_Individual.IdCard2,
Reg_Legal.Name,
Reg_Legal.Contact,
Reg_Legal.LegalForm,
Reg_Legal.CreationDate,
Reg_Legal.ActivityField,
Reg_Legal.ActivityDescription,
Reg_Legal.EFT ,
Reg_Legal.IdCard_1,
Reg_Legal.IdCard_2,
Reg_Legal.IdCard_3,
Reg_Legal.IdCard_4,
Reg_Legal.IdCard_5,
Reg_Legal.IdCard_6,
Reg_Legal.IdCard_7,
Reg_Legal.IdCard_8,
Reg_Legal.IdCard_9,
Reg_Legal.IdCard_10,
Reg_Legal.IdCard_11,
Reg_Legal.IdCard_12,
Reg_Legal.FinState_1,
Reg_Legal.FinState_2,
Reg_Legal.FinState_3,
Reg_Legal.Registration_1,
Reg_Legal.Registration_2,
Reg_Legal.Registration_3
FROM Reg_Person
LEFT OUTER JOIN Reg_RecordType on Reg_RecordType.Id=Reg_Person.RecordTypeId
LEFT OUTER JOIN Reg_Individual on Reg_Individual.Id=Reg_Person.Id
LEFT OUTER JOIN Reg_Legal on Reg_Legal.Id=Reg_Person.Id
LEFT OUTER JOIN Reg_Status on Reg_Status.Id=Reg_Person.StatusId
WHERE Reg_Person.Id = ?';
$stmt = $mysqli->prepare($query);
$stmt->bind_param("i",$id);
$stmt->bind_result($type,$typeName,$status,$statusName,
$FirstName,$LastName,$Gender,$Citizenship,$BirthDate,$IdCard,$IdCard2,
$Name,$Contact,$LegalForm,$CreationDate,$ActivityField,$ActivityDescription,$EFT,
$IdCard_1,$IdCard_2,$IdCard_3,$IdCard_4,$IdCard_5,$IdCard_6,
$IdCard_7,$IdCard_8,$IdCard_9,$IdCard_10,$IdCard_11,$IdCard_12,
$FinState_1,$FinState_2,$FinState_3,$Registration_1,$Registration_2,$Registration_3);
$stmt->execute();
$stmt->fetch();
$stmt->close();
echo'
<!DOCTYPE html>
<html>
<head>';
include 'p_head.php';
makeHead(10);
echo'
<script>
function handleFileDialog(changed) {
if (changed){
var file = document.getElementById("img").files[0];
if(file && file.size < 1048576*'.$uploal_limit_MB.') { // 1 MB (this size is in bytes)
document.forms[\'form\'].submit();
} else {
alert("Ce fichier est trop volumineux! il fait "+Math.round(file.size/10485.76)/100+"MB, la limite est de '.$uploal_limit_MB.'MB.");
}
}
}
var fileSelected = null;
function addPict(name,ind){
document.getElementById("img").onchange = function(e) { // will trigger each time
handleFileDialog(document.getElementById("img").value !== fileSelected);
};
document.getElementById("tp").value=name;
document.getElementById("ind").value=ind;
fileSelected = document.getElementById("img").value;
document.getElementById("img").click();
}
</script>
</head>
<body>';
echo '
<span class="fond"></span>
<span class="cont">
<a class="button" href="consultPerson.php?id='.$id.'&o='.$origin.'">Retour</a><br/>
<h2> Modification des documents pour un compte '.$typeName.' Status: '.$statusName.' </h2>
<form id="form" enctype="multipart/form-data" action="./updateDocs.php" method="post">
<input type="hidden" name="id" value="'.$id.'"/>
<input type="hidden" name="o" value="'.$origin.'" />
<input type="hidden" id="tp" name="tp" value=""/>
<input type="hidden" id="ind" name="ind" value=""/>
<h3> Informations personnelles </h3>';
if($type==1) {
echo '
<span class="fitem">
<span class="label" id="lb_name">Nom de la société: '.$Name.'</span>
</span>
';
} else {
echo'
<span class="fitem">
<span class="label" id="lb_name">Nom: '.$LastName.'</span>
</span>
<span class="fitem">
<span class="label" id="lb_surname" >Prénom: '.$FirstName.'</span>
</span>
';
}
echo'
<h3> Documents </h3>';
$doc=['Carte d\'Identité'=>[$IdCard,$IdCard2]];
if($type==1) {
$doc=['Carte d\'Identité'=>[$IdCard_1,$IdCard_2,$IdCard_3,$IdCard_4,$IdCard_5,$IdCard_6,
$IdCard_7,$IdCard_8,$IdCard_9,$IdCard_10,$IdCard_11,$IdCard_12],
'Etat Financier'=>[$FinState_1,$FinState_2,$FinState_3],
'Registre du commerce'=>[$Registration_1,$Registration_2,$Registration_3]];
}
$type_dict=['Carte d\'Identité'=>'c','Etat Financier'=>'ef','Registre du commerce'=>'r'];
$folder = './Data/img_'.$id.'/';
echo '<table>
<tr><td>Type</td><td>Miniature</td><td>Action</td></tr>';
foreach($doc as $doc_name => $list) {
$counter=1;
foreach($list as $file) {
$set = $file!='';
echo '<tr><td>'.$doc_name.'-'.$counter.'</td><td>';
if ($set){
echo '<a href="'.$folder.$file.'" target="_blank">';
if (strtolower(substr($file, -4)) === '.pdf'){
echo' <img src="css/image/pdf.png" height="100px"/>';
} else {
echo'<img src="'.$folder.$file.'" height="100px"/>';
}
echo'</a>';
} else {
echo 'Pas définit';
}
echo'</td><td>';
if ($set){
echo '<a class="button" onClick="addPict(\''. $type_dict[$doc_name].'\','.$counter.')">Remplacer</a>';
} else {
echo '<a class="button" onClick="addPict(\''. $type_dict[$doc_name].'\','.$counter.')">Ajouter</a>';
}
if ($counter>1){
echo '<a class="button" href="updateDocs.php?id='.$id.'&tp='. $type_dict[$doc_name].'&ind='.$counter.'&o='.$origin.'">Supprimer</a>';
}
echo'</td></tr>';
$counter++;
}
}
echo '</table>
<input type="file" id="img" name="img" accept="application/pdf,image/*" required="required" style="display:none;">
</form>';
echo '
</span>
</body>
</html>';
?>