From dbc1ec20fb1a8f6789d2f599fab7dea0bf3c609d Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 26 May 2016 11:39:58 +0200 Subject: [PATCH] Correction du lien entre les duplications de fiches --- js/includes/input-facebook-fiche-min.js | 4 ++-- js/includes/input-facebook-fiche.js | 2 ++ js/includes/input-phone-fiche-min.js | 4 ++-- js/includes/input-phone-fiche.js | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/js/includes/input-facebook-fiche-min.js b/js/includes/input-facebook-fiche-min.js index c000e96..756892a 100644 --- a/js/includes/input-facebook-fiche-min.js +++ b/js/includes/input-facebook-fiche-min.js @@ -11,8 +11,8 @@ for(b=0;binput[type="radio"][data-name="context"]');for(b=0;binput[type="radio"][data-name="freq"]'); for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;blsi.keys("f_contacts").length?lsi.keys("f_contacts").length:20;if(b.length=c)break}for(var f in d)b=lsi.get("f_contacts",d[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(f)?10+b.sms:b.call, -b=d[b],b.timestamp>=d[f].timestamp||(c=d[f],c.uid=b.uid,lsi.set("f_fiches",b.uid,c)))};inputFacebookFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="facebook"] #f_nav-fiche > span.active'),c=0;clsi.keys("f_contacts").length?lsi.keys("f_contacts").length:20;if(b.length=c)break}var a=lsi["export"]("f_fiches"),f;for(f in a)b=lsi.get("f_contacts",a[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b= +10>parseInt(f)?10+b.sms:b.call,b=a[b],b.timestamp>=a[f].timestamp||(c=a[f],c.uid=b.uid,lsi.set("f_fiches",b.uid,c)))};inputFacebookFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"f_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="facebook"] #f_nav-fiche > span.active'),c=0;cHISTORIQUE");10>e&&c'+(e%10+1)+"  ":(10==e&&(this.nav_container.innerHTML+='MESSENGER'),this.nav_container.innerHTML+=''+ (e%10+1)+"")}for(var d in a)b=$('[data-sublink="facebook"] #f_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="facebook"] #f_nav-fiche [data-n="'+this.selected+'"]'))}; inputFacebookFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0a.reltypeSpecial.length|| diff --git a/js/includes/input-facebook-fiche.js b/js/includes/input-facebook-fiche.js index 671158a..a473b8a 100644 --- a/js/includes/input-facebook-fiche.js +++ b/js/includes/input-facebook-fiche.js @@ -351,6 +351,8 @@ inputFacebookFiche.prototype.sync = function(){ /* (3) Mise à jour des fiches dupliquées entre le top 10 des APPELS et celui des SMS ---------------------------------------------------------*/ + ficheData = lsi.export('f_fiches'); + for( var key in ficheData ){ /* (1) On récupère le contact associé */ var associatedContact = lsi.get('f_contacts', ficheData[key].contact); diff --git a/js/includes/input-phone-fiche-min.js b/js/includes/input-phone-fiche-min.js index 8fec65a..7741861 100644 --- a/js/includes/input-phone-fiche-min.js +++ b/js/includes/input-phone-fiche-min.js @@ -11,8 +11,8 @@ for(b=0;binput[type="radio"][data-name="context"]');for(b=0;binput[type="radio"][data-name="freq"]'); for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;blsi.keys("p_contacts").length?lsi.keys("p_contacts").length:20;console.log("nbMaxFiche:", -e);if(b.length=e)break}for(var f in d)b=lsi.get("p_contacts",d[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(f)?10+b.sms:b.call,b=d[b],b.timestamp>=d[f].timestamp||(c=d[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))}; +inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=[],c;for(c in a){if(-1lsi.keys("p_contacts").length?lsi.keys("p_contacts").length:20;if(b.length< +e)for(c in a){for(a=0;-1=e)break}var d=lsi["export"]("p_fiches"),f;for(f in d)b=lsi.get("p_contacts",d[f].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(f)?10+b.sms:b.call,b=d[b],b.timestamp>=d[f].timestamp||(c=d[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))}; inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),c=0;cAPPELS");10>e&&c'+(e%10+1)+"  ":(10==e&&(this.nav_container.innerHTML+='SMS'),this.nav_container.innerHTML+=''+(e%10+1)+"")}for(var d in a)b= $('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))}; diff --git a/js/includes/input-phone-fiche.js b/js/includes/input-phone-fiche.js index 4bc3052..c704249 100644 --- a/js/includes/input-phone-fiche.js +++ b/js/includes/input-phone-fiche.js @@ -365,7 +365,6 @@ inputPhoneFiche.prototype.sync = function(){ ---------------------------------------------------------*/ // Nombre maximum de fiches (20, sauf si moins de 20 contacts, dans ce cas, le nombre de contacts); var nbMaxFiche = lsi.keys('p_contacts').length < 20 ? lsi.keys('p_contacts').length : 20; - console.log('nbMaxFiche:', nbMaxFiche); // Si moins de 10+10 contacts crées, on les complètes en fonction des contacts séquentiellement if( addedFicheUids.length < nbMaxFiche ){ @@ -403,6 +402,8 @@ inputPhoneFiche.prototype.sync = function(){ /* (3) Mise à jour des fiches dupliquées entre le top 10 des APPELS et celui des SMS ---------------------------------------------------------*/ + ficheData = lsi.export('p_fiches'); + for( var key in ficheData ){ /* (1) On récupère le contact associé */ var associatedContact = lsi.get('p_contacts', ficheData[key].contact); @@ -415,7 +416,6 @@ inputPhoneFiche.prototype.sync = function(){ if( associatedContact.sms == -1 || associatedContact.call == -1 ) continue; // On passe au suivant - /* (3) On récupère l'autre fiche (clone) */ var inCall = parseInt(key) < 10; // Si on est dans le top 10 des APPELS, sinon dans celui des SMS var cloneIndex = inCall ? 10+associatedContact.sms : associatedContact.call; // Contient l'index du clone dans l'autre top (APPELS ou SMS)