try
{
if(!document.isContainer){
//Récupération du nom du document
var nomDocument = document.properties.name;
//Traitement du nom du document
var tempcodesociete = nomDocument.substring(0,2);
var temptypedocument = nomDocument.substring(3,6);
switch(tempcodesociete)
{
case "01":
var codesociete = "01 - Toto"
break;
case "02":
var codesociete = "02 - Titi"
break;
case "04":
var codesociete = "04 - Tutu"
break;
}
switch(temptypedocument)
{
case "001":
var typedocument = "FACTURES FOURNISSEURS"
break;
case "002":
var typedocument = "FACTURES CLIENTS"
break;
}
//Recuperation dossier racine
var nodeDossierGED = companyhome.childByNamePath("Sites/ged/documentLibrary");
if (nodeDossierGED != null){
var nodetypedocument = nodeDossierGED.childByNamePath(typedocument);
if(nodetypedocument == null){
nodetypedocument = nodeDossierGED.createFolder(typedocument);
}
var nodeSociete = nodetypedocument.childByNamePath(codesociete); //Test si le space existe
if(nodeSociete == null) {
var nodeSociete = nodetypedocument.createFolder(codesociete);
}
}
//On déplace le fichier
document.move(nodeSociete);
}
}
}
catch(exception)
{
throw exception;
}
if(!document.isContainer){
//Récupération du nom du document
var nomDocument = document.properties.name;
//Traitement du nom du document
var tempcodesociete = nomDocument.substring(0,2);
var temptypedocument = nomDocument.substring(3,6);
//Recuperation date courante
var now = new Date();
var annee = now.getFullYear();
var tempmois = now.getMonth() + 1;
switch(tempcodesociete)
{
case "01":
var codesociete = "01 - Toto"
break;
case "02":
var codesociete = "02 - Titi"
break;
case "04":
var codesociete = "04 - Tutu"
break;
}
switch(temptypedocument)
{
case "001":
var typedocument = "FOURNISSEURS"
break;
case "002":
var typedocument = "CLIENTS"
break;
}
switch(tempmois)
{
case 1:
var mois = "01 - Janvier"
break;
case 2:
var mois = "02 - Fevrier"
break;
case 3:
var mois = "03 - Mars"
break;
case 4:
var mois = "04 - Avril"
break;
case 5:
var mois = "05 - Mai"
break;
case 6:
var mois = "06 - Juin"
break;
case 7:
var mois = "07 - Juillet"
break;
case 8:
var mois = "08 - Aout"
break;
case 9:
var mois = "09 - Septembre"
break;
case 10:
var mois = "10 - Octobre"
break;
case 11:
var mois = "01 - Novembre"
break;
case 12:
var mois = "12 - Decembre"
break;
}
//Recuperation dossier racine
var nodeDossierGED = companyhome.childByNamePath("Sites/ged/documentLibrary");
if (nodeDossierGED != null){
var nodetypedocument = nodeDossierGED.childByNamePath(typedocument);
if(nodetypedocument == null){
nodetypedocument = nodeDossierGED.createFolder(typedocument);
}
var nodeSociete = nodetypedocument.childByNamePath(codesociete);
if(nodeSociete == null) {
nodeSociete = nodetypedocument.createFolder(codesociete);
}
var nodeAnnee = nodeSociete.childByNamePath(annee);
if(nodeAnnee == null) {
nodeAnnee = nodeSociete.createFolder(annee);
}
var nodeMois = nodeAnnee.childByNamePath(mois);
if(nodeMois == null) {
nodeMois = nodeAnnee.createFolder(mois);
}
}
//On déplace le fichier
document.move(nodeMois);
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.