try
{
if(!document.isContainer){
//Récupération du nom du document
var nomDocument = document.properties.name;
//Traitement du nom du document
var codesociete = nomDocument.substring(0,2);
var compteclient = nomDocument.substring(2,10);
var typedocument = nomDocument.substring(10,nomDocument.length-4); //nomDocument.length-4 pour retirer ".pdf"
//On récupere le noeud facture (présent à la racine du companyhome)
var nodeDossierFactures = companyhome.childByNamePath("Factures");
if (nodeDossierFactures != null){
var nodeSociete = nodeDossierFactures.childByNamePath("Societe "+codesociete); //Test si le space existe
if(nodeSociete == null){
//On créé le dossier Société n°XX s'il n'existe pas
nodeSociete = nodeDossierFactures.createFolder("Societe "+codesociete);
}
var nodeCompteClient = nodeSociete.childByNamePath(compteclient); //Test si le space existe
if(nodeCompteClient == null) {
//On créé le dossier compteclient s'il n'existe pas
nodeCompteClient = nodeSociete.createFolder(compteclient);
}
//On déplace le fichier
document.move(nodeCompteClient);
}
}
}
catch(exception)
{
throw exception;
}
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.