08-31-2015 11:43 AM
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;
}
09-01-2015 12:03 PM
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);
}
08-01-2024 12:39 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.