Enregistrement de 'tmp_id' après upload

This commit is contained in:
xdrm-brackets 2016-05-13 11:47:45 +02:00
parent db6f7f1319
commit bbbad320e7
5 changed files with 877 additions and 17457 deletions

View File

@ -233,7 +233,7 @@
);
/* (2) On met le contenu en json */
$phone_storage = json_encode($phone_storage, JSON_PRETTY_PRINT);
$phone_storage = json_encode($phone_storage);
/* (3) On l'enregistre dans le fichier */
$written = file_put_contents( __ROOT__.'/tmp/phone_storage_'.$subject_id.'.json', $phone_storage);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

16
view/js/input-min.js vendored
View File

@ -5,11 +5,11 @@ matriceManager.storageToFields(),(c||f)&&contactManager.storageToFields()}functi
include("/js/includes/input-phone-subject.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){include("/js/includes/input-phone-matrice.js",function(){subjectManager=new inputPhoneSubject($('article.subject-panel [data-name="tmp_id"]'),$('article.subject-panel [data-name="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'),
$('article.subject-panel [data-name="lastname"]'),$('article.subject-panel [data-name="submit"]'));subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("#nav-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);matriceManager=new inputPhoneMatrice($("article.matrice-panel"));
matriceManager.attach(dynamicUpdate);$('input#call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:a.target.files[0]};api.send(a,function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):
Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");subjectManager.tmp_id.value=a.tmp_id;for(var e=0;e<a.call.length;e++){var c=a.directory[a.call[e]],d=c.name.split(" ");lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:e,sms:-1})}for(e=0;e<a.sms.length;e++)c=a.directory[a.sms[e]],-1<a.call.indexOf(a.sms[e])?
(d=lsi.get("contacts",c.id),d.sms=e,lsi.set("contacts",c.id,d)):(d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:e}));for(var g in a.directory)g=parseInt(g),-1<a.call.indexOf(g)||-1<a.sms.indexOf(g)||(c=a.directory[g],d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?
d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:-1}));contactManager.storageToFields();dynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$("#clear-all").addEventListener("click",function(a){lsi.clear("subject");lsi.clear("contacts");lsi.clear("mini-fiches");lsi.clear("fiches");lsi.clear("matrice");subjectManager.storageToFields();contactManager.storageToFields();miniManager.storageToFields();ficheManager.storageToFields();
matriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$("#export-all").addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var f=$("#download-target");f.download="local-data.json";f.href=
"data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));f.click()},!1);$("#import-all").addEventListener("click",function(a){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(a){a.target.value=null},!1);$("#local-upload").addEventListener("change",function(a){a={path:"upload/local_data",file:$("#local-upload").files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("subject",
0,a.local_data.subject);lsi["import"]("contacts",a.local_data.contacts);lsi["import"]("mini-fiches",a.local_data.mini);lsi["import"]("fiches",a.local_data.fiches);lsi.set("matrice",0,a.local_data.matrice);subjectManager.storageToFields();contactManager.storageToFields();matriceManager.storageToFields();dynamicUpdate(!0)})},!1);$("#submit-all").addEventListener("click",function(a){console.log("> GATHERING ALL DATA");subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage();
ficheManager.fieldsToStorage();if(!subjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("mini-fiches");var f=0,b;for(b in a)if(!isNaN(b)&&(f++,!a[b].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+f+"</b> est incompl\u00e8te et/ou incorrecte"),!1;b={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),
matrice:lsi["export"]("matrice")[0]};api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})});
Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");subjectManager.tmp_id.value=a.tmp_id;subjectManager.fieldsToStorage();subjectManager.storageToFields();for(var e=0;e<a.call.length;e++){var c=a.directory[a.call[e]],d=c.name.split(" ");lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:e,sms:-1})}for(e=0;e<
a.sms.length;e++)c=a.directory[a.sms[e]],-1<a.call.indexOf(a.sms[e])?(d=lsi.get("contacts",c.id),d.sms=e,lsi.set("contacts",c.id,d)):(d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:e}));for(var g in a.directory)g=parseInt(g),-1<a.call.indexOf(g)||-1<a.sms.indexOf(g)||(c=a.directory[g],d=c.name.split(" "),lsi.set("contacts",c.id,{uid:c.id,
number:c.number,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:c.sms,countcall:c.call,call:-1,sms:-1}));contactManager.storageToFields();dynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$("#clear-all").addEventListener("click",function(a){lsi.clear("subject");lsi.clear("contacts");lsi.clear("mini-fiches");lsi.clear("fiches");lsi.clear("matrice");subjectManager.storageToFields();contactManager.storageToFields();
miniManager.storageToFields();ficheManager.storageToFields();matriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$("#export-all").addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var f=
$("#download-target");f.download="local-data.json";f.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));f.click()},!1);$("#import-all").addEventListener("click",function(a){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(a){a.target.value=null},!1);$("#local-upload").addEventListener("change",function(a){a={path:"upload/local_data",file:$("#local-upload").files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",
a.ModuleError),!1;lsi.set("subject",0,a.local_data.subject);lsi["import"]("contacts",a.local_data.contacts);lsi["import"]("mini-fiches",a.local_data.mini);lsi["import"]("fiches",a.local_data.fiches);lsi.set("matrice",0,a.local_data.matrice);subjectManager.storageToFields();contactManager.storageToFields();matriceManager.storageToFields();dynamicUpdate(!0)})},!1);$("#submit-all").addEventListener("click",function(a){console.log("> GATHERING ALL DATA");subjectManager.fieldsToStorage();contactManager.fieldsToStorage();
miniManager.fieldsToStorage();ficheManager.fieldsToStorage();if(!subjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("mini-fiches");var f=0,b;for(b in a)if(!isNaN(b)&&(f++,!a[b].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+f+"</b> est incompl\u00e8te et/ou incorrecte"),!1;b={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),
fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})});

View File

@ -280,6 +280,8 @@ include('/js/includes/input-phone-matrice.js', function(){
/* (3) On enregistre l'identifiant temporaire du sujet */
subjectManager.tmp_id.value = response.tmp_id;
subjectManager.fieldsToStorage();
subjectManager.storageToFields();
@ -547,7 +549,7 @@ include('/js/includes/input-phone-matrice.js', function(){
/* (4) On envoie la requête et traite la réponse */
api.send(request, function(response){
console.log(response);
// Si erreur, on la notifie
if( response.ModuleError != 0 ){
Notification.error('ERREUR', response.ModuleError);