// We create the folder to place the txt file
var subir = space.childByNamePath("Subir Facturas");
var recoger = subir.childByNamePath("Recoger");
// If there is already a txt file we must delete it
for each (var doc in recoger.children) {
if (doc.mimetype == "text/plain");
doc.remove();
}
// Get the path to the parent space where to look for the files
var revision = space.childByNamePath("Revisar");
var aprobados = revision.childByNamePath("Aprobadas");
var today = new Date();
var ano = today.getFullYear();
var buscarAno = aprobados.childByNamePath(ano);
// Now we firstly create the txt file
//String fecha = today.getDate() + "-" + today.getMonth() +1 + "-" + today.getFullYear();
file = recoger.createFile("metadatos_facturas.txt");
// We run the search for all the pdf files that have been modified today in the
// space of the current year
var docs = search.xpathSearch([cm:modified]=today,buscarAno);
// For each doc found matching the search clause we must write their metadata in the
// txt file - one row with metadata per file found
for each (docs) {
if (docs!=null && docs.mimetype == "application/pdf")
{
workingcopy=file.checkout();
workingcopy.content = "|"+docs.name+"|"+docs.start_date+"|"+docs.Private_Id+"|=";
file = workingcopy.checkin();
}
}
var docs = search.luceneSearch("PATH:'app:company_home/cm:Revisar/cm:Aprobados//.' AND @cm\\:modified:[NOW TO MAX]");
var sdate=today.getFullYear()+"\-"+(today.getMonth()+1)+"\-"+today.getDate() + "T00:00:00";
var tdate=today.getFullYear()+"\-"+(today.getMonth()+1)+"\-"+(today.getDate()+1) + "T00:00:00";
var spath="'+PATH:\""+aprobados.displayPath +"//*\" + ";
var scontent="@\\{http\\://www.alfresco.org/model/content/1.0\\}content.mimetype:application/pdf + ";
var qdate="@cm\\:modified:[" + sdate + " TO " + tdate +"]'";
var strq=spath+scontent+qdate;
// Do the search and save the vales
var nodes=search.luceneSearch(strq);
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.