Prise en compte des différents formats de journaux d'appels + import données cellulaires en zip contenant des csv pour excel.

This commit is contained in:
xdrm-brackets 2016-05-12 14:30:42 +02:00
parent c1eb819c6f
commit b31983fa4b
10 changed files with 910 additions and 1059 deletions

View File

@ -18,10 +18,15 @@
"10": "55 à 60", "11": "60 à 65", "12": "65 à 70", "13": "70 à 75", "14": "75 à 80", "10": "55 à 60", "11": "60 à 65", "12": "65 à 70", "13": "70 à 75", "14": "75 à 80",
"15": "80 à 85", "16": "85 à 90", "17": "90 à 95", "18": "95 à 100" "15": "80 à 85", "16": "85 à 90", "17": "90 à 95", "18": "95 à 100"
}, },
"studies": {
".": "Non défini"
"studies": {
".": "Non défini",
"0": "Inconnu",
"1": "< BAC",
"2": "BAC",
"3": "BAC+2",
"4": "BAC+3",
"5": "BAC+4 et plus"
}, },
"reltype": { "reltype": {

File diff suppressed because one or more lines are too long

View File

@ -93,31 +93,12 @@ miniFicheBuilder.setLayout(
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
"\t\t<span class='select-container'><select data-name='studies'>\n"+ "\t\t<span class='select-container'><select data-name='studies'>\n"+
"\t\t\t<option value='.' disabled selected>Niveau d'études maximal:</option>\n"+ "\t\t\t<option value='.' disabled selected>Niveau d'études maximal:</option>\n"+
"\t\t\t<option value='0'>Inconnue</option>\n"+ "\t\t\t<option value='0'>Inconnu</option>\n"+
"\t\t\t<option value='01'>Pas de scolarité</option>\n"+ "\t\t\t<option value='1'>< BAC</option>\n"+
"\t\t\t<option value='02'>Aucun diplôme mais scolarité jusqu'en école primaire ou au collège</option>\n"+ "\t\t\t<option value='2'>BAC</option>\n"+
"\t\t\t<option value='03'>Aucun diplôme mais scolarité au-delà du collège</option>\n"+ "\t\t\t<option value='3'>BAC+2</option>\n"+
"\t\t\t<option value='04'>Certificat d'études primaires (CEP)</option>\n"+ "\t\t\t<option value='4'>BAC+3</option>\n"+
"\t\t\t<option value='05'>BEPC, brevet élémentaire, brevet des collèges</option>\n"+ "\t\t\t<option value='5'>BAC+4 et plus</option>\n"+
"\t\t\t<option value='06'>Certificat d'aptitudes professionnelles (CAP), brevet de compagnon, y compris CAPA</option>\n"+
"\t\t\t<option value='07'>Brevet d'études professionnelles (BEP), y compris BEPA et diplômes agricoles (BAA, BPA)</option>\n"+
"\t\t\t\t<option value='07' class='pad'>Diplômes sociaux (aide-soignante, auxiliaire de puériculture, travailleuse familiale)</option>\n"+
"\t\t\t<option value='08'>Baccalauréat général, brevet supérieur</option>\n"+
"\t\t\t\t<option class='pad' value='08'>BAC ( L, ES, S ou A, B , C, D, D, E )</option>\n"+
"\t\t\t<option value='09'>Bac technologique ou professionnel, brevet professionnel ou de technicien</option>\n"+
"\t\t\t\t<option class='pad' value='09'>BAC (STI, STL, SMS, STT ou F, G, H)</option>\n"+
"\t\t\t\t<option class='pad' value='09'>BEC, BEI, BEH, capacité en droit</option>\n"+
"\t\t\t\t<option class='pad' value='09'>Brevet de technicien agricole (BTA)</option>\n"+
"\t\t\t<option value='10'>Diplôme universitaire de 1er cycle</option>\n"+
"\t\t\t\t<option class='pad' value='10'>BTS, DUT, DEUG</option>\n"+
"\t\t\t\t<option class='pad' value='10'>Diplôme des professions sociales ou de santé, d'infirmier(ère)</option>\n"+
"\t\t\t\t<option class='pad' value='10'>Diplôme universitaire propédeutique, DUEL, DUES, DEUG, PCEM</option>\n"+
"\t\t\t<option value='11'>Diplôme universitaire de 2ème ou 3ème cycle</option>\n"+
"\t\t\t\t<option class='pad' value='11'>MASTER, DOCTORAT (y compris médecine, pharmacie, dentaire),</option>\n"+
"\t\t\t\t<option class='pad' value='11'>Maîtrise, DEA, DESS,</option>\n"+
"\t\t\t\t<option class='pad' value='11'>CAPES, CAPET, agrégation</option>\n"+
"\t\t\t\t<option class='pad' value='11'>Diplôme d'ingénieur, d'une grande école, etc.</option>\n"+
"\t\t</select></span>\n"+ "\t\t</select></span>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
@ -286,8 +267,9 @@ ficheBuilder.setLayout(
"\t\tSituation familiale:<br>\n"+ "\t\tSituation familiale:<br>\n"+
"\t\t<h5 class='nobold color0'>\n"+ "\t\t<h5 class='nobold color0'>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitA_@uid' value='0'><label for='famsitA_@uid'>Seul</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitA_@uid' value='0'><label for='famsitA_@uid'>Seul</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitB_@uid' value='1'><label for='famsitB_@uid'>En couple sans enfants</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitB_@uid' value='1'><label for='famsitB_@uid'>Seul avec enfant(s)</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitC_@uid' value='2'><label for='famsitC_@uid'>En couple avec enfants</label>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitC_@uid' value='2'><label for='famsitC_@uid'>En couple sans enfants</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='famsit_@uid' data-name='famsit' id='famsitD_@uid' value='3'><label for='famsitD_@uid'>En couple avec enfants</label>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
@ -329,8 +311,8 @@ ficheBuilder.setLayout(
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype3_@uid' value='3'><label for='reltype3_@uid'>Relation amoureuse</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype3_@uid' value='3'><label for='reltype3_@uid'>Relation amoureuse</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype4_@uid' value='4'><label for='reltype4_@uid'>Collègue</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype4_@uid' value='4'><label for='reltype4_@uid'>Collègue</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype5_@uid' value='5'><label for='reltype5_@uid'>Voisin</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype5_@uid' value='5'><label for='reltype5_@uid'>Voisin</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype6_@uid' value='6'><label for='reltype6_@uid'>Ami</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype6_@uid' value='6'><label for='reltype6_@uid'>Ami proche</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype7_@uid' value='7'><label for='reltype7_@uid'>Copain</label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype7_@uid' value='7'><label for='reltype7_@uid'>Ami</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype8_@uid' value='8'><label for='reltype8_@uid'>Autre : <input type='text' data-name='reltypeSpecial' placeholder='coéquipier de tennis, ..' value='@reltypespecial'></label><br>\n"+ "\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='reltype_@uid' data-name='reltype' id='reltype8_@uid' value='8'><label for='reltype8_@uid'>Autre : <input type='text' data-name='reltypeSpecial' placeholder='coéquipier de tennis, ..' value='@reltypespecial'></label><br>\n"+
"\t</h5>\n"+ "\t</h5>\n"+

2
js/lib/notif-min.js vendored
View File

@ -1,5 +1,5 @@
var NotificationClass=function(a){this.container=a};NotificationClass.prototype={container:this.container,stack:[],types:["warning","info","success","error"],defaultTimeout:2E3,errorCodes:{}};NotificationClass.prototype.pushStack=function(a,c,b){if(!(a instanceof Array&&b instanceof Array))return null;var e=-1,d;for(d in a)if(-1<b.indexOf(a[d])){e=d;break}if(-1==e)return a.push(c)-1;a[e]=c;return e}; var NotificationClass=function(a){this.container=a};NotificationClass.prototype={container:this.container,stack:[],types:["warning","info","success","error"],defaultTimeout:2E3,errorCodes:{}};NotificationClass.prototype.pushStack=function(a,c,b){if(!(a instanceof Array&&b instanceof Array))return null;var e=-1,d;for(d in a)if(-1<b.indexOf(a[d])){e=d;break}if(-1==e)return a.push(c)-1;a[e]=c;return e};
NotificationClass.prototype.hide=function(a){if(isNaN(a))return!1;a=parseInt(a);this.container.removeChild(this.stack[a].element);this.stack[a]=null}; NotificationClass.prototype.hide=function(a){if(isNaN(a))return!1;a=parseInt(a);this.stack[a].element instanceof Element&&this.container.removeChild(this.stack[a].element);this.stack[a]=null};
NotificationClass.prototype.show=function(a,c,b,e){a=-1<this.types.indexOf(a)?a:this.types[0];c="string"==typeof c?c:"";b="string"==typeof b.toString()?b:"...";null!=this.errorCodes[b]&&(b=this.errorCodes[b]);e="number"==typeof e?e:this.defaultTimeout;var d={element:document.createElement("div"),type:a,title:c,message:b,timeout:null};d.element.className="notification-element";d.element.setAttribute("data-"+a,"");d.element.innerHTML="<p><strong>"+c+":</strong> "+b+"<p>";this.container.appendChild(d.element); NotificationClass.prototype.show=function(a,c,b,e){a=-1<this.types.indexOf(a)?a:this.types[0];c="string"==typeof c?c:"";b="string"==typeof b.toString()?b:"...";null!=this.errorCodes[b]&&(b=this.errorCodes[b]);e="number"==typeof e?e:this.defaultTimeout;var d={element:document.createElement("div"),type:a,title:c,message:b,timeout:null};d.element.className="notification-element";d.element.setAttribute("data-"+a,"");d.element.innerHTML="<p><strong>"+c+":</strong> "+b+"<p>";this.container.appendChild(d.element);
var f=this.pushStack(this.stack,d,[null]);d.element.id=f;var g=this;d.element.className="notification-element notification-visible";setTimeout(function(){d.element.className="notification-element"},500+e);d.timeout=setTimeout(function(){g.hide(f)},500+e+500);d.element.addEventListener("click",function(a){g.hide(f)},!1);return d.element};NotificationClass.prototype.warning=function(a,c,b){return this.show("warning",a,c,b)}; var f=this.pushStack(this.stack,d,[null]);d.element.id=f;var g=this;d.element.className="notification-element notification-visible";setTimeout(function(){d.element.className="notification-element"},500+e);d.timeout=setTimeout(function(){g.hide(f)},500+e+500);d.element.addEventListener("click",function(a){g.hide(f)},!1);return d.element};NotificationClass.prototype.warning=function(a,c,b){return this.show("warning",a,c,b)};
NotificationClass.prototype.info=function(a,c,b){return this.show("info",a,c,b)};NotificationClass.prototype.success=function(a,c,b){return this.show("success",a,c,b)};NotificationClass.prototype.error=function(a,c,b){return this.show("error",a,c,b)}; NotificationClass.prototype.info=function(a,c,b){return this.show("info",a,c,b)};NotificationClass.prototype.success=function(a,c,b){return this.show("success",a,c,b)};NotificationClass.prototype.error=function(a,c,b){return this.show("error",a,c,b)};

View File

@ -80,8 +80,10 @@ NotificationClass.prototype.hide = function(id){
id = parseInt(id); id = parseInt(id);
/* (1) Suppression de l'élément */ /* (1) Suppression de l'élément */
this.container.removeChild( this.stack[id].element ); if( this.stack[id].element instanceof Element )
this.container.removeChild( this.stack[id].element );
/* (2) On supprime la notification de la pile */ /* (2) On supprime la notification de la pile */
this.stack[id] = null; this.stack[id] = null;

View File

@ -89,8 +89,8 @@
/* (5) On complète le log */ /* (5) On complète le log */
$phone_log = array( $phone_log = array(
'source' => ($log['Direction']!='OUTCOMING') ? $number : Database::formatNumber($phone_number), 'source' => ($log['Direction']!='OUTGOING') ? $number : Database::formatNumber($phone_number),
'target' => ($log['Direction']!='OUTCOMING') ? Database::formatNumber($phone_number) : $number, 'target' => ($log['Direction']!='OUTGOING') ? Database::formatNumber($phone_number) : $number,
'missed' => $log['Direction']==['MISSED'], 'missed' => $log['Direction']==['MISSED'],
'type' => strtolower($log['Type']), 'type' => strtolower($log['Type']),
'date' => strtotime($log['Date']), 'date' => strtotime($log['Date']),

View File

@ -158,8 +158,7 @@
// Vérification de tous les champs // Vérification de tous les champs
foreach($xml->Item as $log){ foreach($xml->Item as $log){
$checkAttributes = isset($log['Id']); $checkAttributes = isset($log['Number']);
$checkAttributes = $checkAttributes && isset($log['Number']);
$checkAttributes = $checkAttributes && isset($log['Name']); $checkAttributes = $checkAttributes && isset($log['Name']);
$checkAttributes = $checkAttributes && isset($log['Date']); $checkAttributes = $checkAttributes && isset($log['Date']);
$checkAttributes = $checkAttributes && isset($log['Duration']); $checkAttributes = $checkAttributes && isset($log['Duration']);

File diff suppressed because it is too large Load Diff

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

@ -5,11 +5,12 @@ matriceManager.storageToFields(),(g||a)&&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="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'),$('article.subject-panel [data-name="lastname"]'), 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="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); $('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(b){b.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(b){b={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:b.target.files[0]};api.send(b,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", $('input#call_log-import[type="file"]').addEventListener("click",function(b){b.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(b){b={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:b.target.files[0]};api.send(b,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{for(var b=Notification.info("Info","Chargement du journal d'appel"),f=0,g=[],c=0;c<a.calls.length&&10>c;c++)g.push(a.calls[c].number);for(c=0;c<g.length;c++){var d=a.directory[g[c]].name.split(" ");lsi.set("contacts",f,{uid:f,number:g[c],username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[g[c]].sms,countcall:a.directory[g[c]].calls,call:c,sms:-1});f++}console.warn(1);for(var h=[],c=0;c<a.sms.length&&10>c;c++)h.push(a.sms[c].number); a.ModuleError);else{for(var b=Notification.info("Info","Chargement du journal d'appel"),f=0,g=[],c=0;c<a.calls.length&&10>c;c++)g.push(a.calls[c].number);for(c=0;c<g.length;c++){var d=[""];null!=a.directory[g[c]].name&&(d=a.directory[g[c]].name.split(" "));lsi.set("contacts",f,{uid:f,number:g[c],username:0<d.length?d[0]:"",firstname:0<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[g[c]].sms,countcall:a.directory[g[c]].calls,call:c,sms:-1});f++}for(var h=[],c=0;c<
for(c=0;c<h.length;c++)if(d=g.indexOf(h[c]),-1<d){var l=lsi.get("contacts",d);l.sms=c;lsi.set("contacts",d,l)}else d=[""],null!=a.directory[h[c]].name&&(d=a.directory[h[c]].name.split(" ")),lsi.set("contacts",f,{uid:f,number:h[c],username:0<d.length?d[0]:"",firstname:0<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[h[c]].sms,countcall:a.directory[h[c]].calls,call:-1,sms:c}),f++;for(var k in a.directory)-1<g.indexOf(k)||-1<h.indexOf(k)||(d=(null===a.directory[k].name? a.sms.length&&10>c;c++)h.push(a.sms[c].number);for(c=0;c<h.length;c++)if(d=g.indexOf(h[c]),-1<d){var l=lsi.get("contacts",d);l.sms=c;lsi.set("contacts",d,l)}else d=[""],null!=a.directory[h[c]].name&&(d=a.directory[h[c]].name.split(" ")),lsi.set("contacts",f,{uid:f,number:h[c],username:0<d.length?d[0]:"",firstname:0<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[h[c]].sms,countcall:a.directory[h[c]].calls,call:-1,sms:c}),f++;for(var k in a.directory)-1<g.indexOf(k)||
"":a.directory[k].name).split(" "),lsi.set("contacts",f,{uid:f,number:k,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[k].sms,countcall:a.directory[k].calls,call:-1,sms:-1}),f++);console.warn(3);contactManager.storageToFields();dynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$("#clear-all").addEventListener("click",function(b){lsi.clear("subject");lsi.clear("contacts");lsi.clear("mini-fiches"); -1<h.indexOf(k)||(d=(null===a.directory[k].name?"":a.directory[k].name).split(" "),lsi.set("contacts",f,{uid:f,number:k,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[k].sms,countcall:a.directory[k].calls,call:-1,sms:-1}),f++);contactManager.storageToFields();dynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$("#clear-all").addEventListener("click",function(b){lsi.clear("subject");
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(b){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");b={subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"), 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(b){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");b={subject:lsi["export"]("subject")[0],
mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var a=$("#download-target");a.download="local-data.json";a.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));a.click()},!1);$("#import-all").addEventListener("click",function(b){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(b){b.target.value=null},!1);$("#local-upload").addEventListener("change",function(b){b={path:"upload/local_data", contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var a=$("#download-target");a.download="local-data.json";a.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));a.click()},!1);$("#import-all").addEventListener("click",function(b){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(b){b.target.value=null},!1);$("#local-upload").addEventListener("change",function(b){b=
file:$("#local-upload").files[0]};api.send(b,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", {path:"upload/local_data",file:$("#local-upload").files[0]};api.send(b,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)})},
function(b){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;b=lsi["export"]("mini-fiches");for(var a in b)if(!b[a].valid)return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+(parseInt(a)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;b=lsi["export"]("fiches"); !1);$("#submit-all").addEventListener("click",function(b){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;b=lsi["export"]("mini-fiches");for(var a in b)if(!b[a].valid)return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+(parseInt(a)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),
for(a in b)if(!b[a].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(a)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a={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(a,function(a){if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})}); !1;b=lsi["export"]("fiches");for(a in b)if(!b[a].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(a)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a={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(a,function(a){if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},
!1)},!1)})})})})});

View File

@ -277,7 +277,6 @@ include('/js/includes/input-phone-matrice.js', function(){
loadingNotif = Notification.info('Info', 'Chargement du journal d\'appel'); loadingNotif = Notification.info('Info', 'Chargement du journal d\'appel');
var uid = 0; // Contiendra l'uid des contacts var uid = 0; // Contiendra l'uid des contacts
/* (3) On récupère les contacts les plus APPELLÉS */ /* (3) On récupère les contacts les plus APPELLÉS */
@ -287,14 +286,17 @@ include('/js/includes/input-phone-matrice.js', function(){
/* (4) On crée les 10 contacts les plus APPELÉS */ /* (4) On crée les 10 contacts les plus APPELÉS */
for( var i = 0 ; i < most_called.length ; i++ ){ for( var i = 0 ; i < most_called.length ; i++ ){
var splittedName = response.directory[most_called[i]].name.split(' ');
var splittedName = [''];
if( response.directory[most_called[i]].name != null )
splittedName = response.directory[most_called[i]].name.split(' ');
lsi.set('contacts', uid, { lsi.set('contacts', uid, {
uid: uid, uid: uid,
number: most_called[i], number: most_called[i],
username: splittedName.length == 1 ? splittedName[0] : '', // Si un seul mot -> pseudo username: splittedName.length > 0 ? splittedName[0] : '', // Si un seul mot -> pseudo
firstname: splittedName.length > 1 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom firstname: splittedName.length > 0 ? splittedName[0] : '', // Si plusieurs mots -> le 1er est le prénom
lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom lastname: splittedName.length > 1 ? splittedName.splice(1).join(' ') : '', // et les autres sont le nom
countsms: response.directory[most_called[i]].sms, // Nombre de sms countsms: response.directory[most_called[i]].sms, // Nombre de sms
countcall: response.directory[most_called[i]].calls, // Nombre d'appels countcall: response.directory[most_called[i]].calls, // Nombre d'appels
call: i, // classement dans le top 10 des APPELS call: i, // classement dans le top 10 des APPELS
@ -304,9 +306,6 @@ include('/js/includes/input-phone-matrice.js', function(){
uid++; uid++;
} }
console.warn(1);
/* (5) On récupère les contacts les plus SMSÉS */ /* (5) On récupère les contacts les plus SMSÉS */
var most_sms = []; var most_sms = [];
@ -377,8 +376,6 @@ include('/js/includes/input-phone-matrice.js', function(){
uid++; uid++;
} }
console.warn(3);
/* (8) On met à jour l'affichage */ /* (8) On met à jour l'affichage */
contactManager.storageToFields(); contactManager.storageToFields();
dynamicUpdate(true); dynamicUpdate(true);