Grupeer bulk download agreements 2

Download all Grupeer agreements PDFs

< Feedback op Grupeer bulk download agreements 2

Recensie: Goed - het script werkt zoals het hoort

§
Geplaatst: 23-04-2020

Add project name for development projects

Hi, I like your script, works great! I made a small adjustment so thast for Primo Invest development projects, also the project name is added in the filename

for anyone interested, here the adjustments

Add function

        function getProjectNameFromUrl(url) {
            var projectName = "";
            jQuery.ajaxSetup({async:false});
            $.get( url, function( data ) {
                projectName = /<title>(.*?)<\/title>/.exec(data)[1].replace("Invest in the development project", " -");
            });
            jQuery.ajaxSetup({async:true});

            return projectName;
        }

Add var's inside for each loan loop and call function

                var url_project = $loan_row.find('.flex-block.md a').attr('href');
                var projectName = "";

                if (url_project.startsWith("project/")) {
                   projectName = getProjectNameFromUrl(url_project);
                }

and add project name to file name

                download_pdf(url_pdf, 'GRP ' + agreement_id + ' - ' + project_id + ' (' + loan_originator + projectName + ').pdf');
§
Geplaatst: 24-04-2020
Bijgewerkt: 24-04-2020

Hi.

Thanks! I incorporated your code. I adjusted your naming convention a bit, let me know if you see this as a problem. Your naming convention vs. what I did: "GRP 681123 - GRP-2558 (Primo invest - Development project - Impersky).pdf" "Grupeer Agreement - 681123 - GRP-2558 (Primo invest_Development project - Impersky).pdf"

(I wish I understood JavaScript, I just copied Alberizo's original script and corrected agreement ID + 1000 :))

Reactie plaatsen

Log in om antwoord te geven.