Viewslist: add menu item (print pdf)

Hi everybody,
I need to add a “Print pdf” in the list view of my custom module.
But before trying to use the function to print pdf, I can’t make the item appear in the menu (while I did this integration without problems in the detail view).

I followed both the examples shown by pgr here Adding button in listview page and this blog -guides / suitecrm-a-pdf-guide
but the item in the menu does not appear and without errors…

I have the feeling that my views.list.php so built, is ignored in custom folder since there is no views.list.php in the original module.

I’m using version 7.11.2.

Can anyone give me support?

Thanks so much.

I think, the correct name of file should be “view.list.php” .

1 Like

Hi, yes I realized the error and now everything works. Thanks was so obvious that I didn’t see it.
However, something strange happens in “Bulk Action”, I see “Email” when the user cannot access to the Email module but only accesses these custom modules (see screenshot).
How is it possible? Can I delete the entry?

I don’t see your code. May be your code don’t include check access for user before include button “Componi Email”.

This problem also occurs without the change to print pdf.
Basically this is a custom module, made with Builder from a basic module and it doesn’t even have the file view.list.php.
The user in question sees only this and another custom module, the others are all disabled and does not have the email configured in his profile. So, where can this menu item come from? What checks can I make?
Thanks so much.

Hi and sorry for the double post.
Only now, I am realizing that the export has 2 problems

  • if there are few records, pdf is exported correctly, while if there are many I receive a “Database Error”.
    Is there any parameter I need to change in my php.ini?

  • If I select more rows to export, for example 3, it creates a three-page pdf instead of continuing to put the rows of the table one below the other as happens on lineitems in the offers.
    Is there a solution for this?

Many thanks.

About “Composi Email”
You made custom module based on “Person” object. This object have field “email” and when there is field “email” in vardefs.php the button “Composi Email” is automatic included. You can see file: include/ListView/ListViewDisplay.php if you find the call “buildComposeEmailLink”. You can make:

  1. Switch off “Person” object from custom vardefs.php of your module. Include only needed fields to you custom vardefs.php fields from “Person” object.
  2. You can unset field “email” from custom vardefs of your module.
    I think that the first way is better.
1 Like

Oh, thanks for your valuable suggestion.
Can you also suggest something about the two export pdf problems?

About a possible export size limit I don’t know where to intervene but on the second point, I saw that this is the standard behavior even if you export from listview of the lead module, for example. Can this be changed in some way and get an export formatted on several consecutive lines?

Thanks again for your time.

About database.
I didn’t see this poroblem ever. I tested some decison which I have now. Export from different modules work with out problem. May be you can give some more information from your log files (SuiteCRM and web-server).
About pdf.
I don’t understend. You did write about standart export of module records to csv file or about somethink export to pdf format?

Hi and thanks for reply.
For database, I try to get out of logs and let you know.

As for pdf: the export from listview generates a record per sheet. So pdf will have as many pages as there are lines exported (and even on standard modules, like leads, it works like this).
I, however, I would like all the lines below each other (as happens to the items in quote module).
Keep in mind that the code follows this guide:

I know I should use reports to get this but, in this specific case, I can’t.
I hope there is a way to get what I need.

Thanks again.

Sorry I didn’t work with pdf export.

Hi and thanks to everyone.

So, in the meantime I saw that the new page is created with
$ Pdf-> AddPage ();
in formLetterPdf.php > AOS_PDF_Templates

So, theoretically if I exclude this variable, records are written one under the other and not in a new page (maybe there is also the way to put an if and make sure that the modification is performed only for a specific module) . Perhaps this can also be used by others for a workaround.

However, both in the standard version and in the modified version, I continue to receive an error if I export more than 20 records (in practice if I export more pages).

The error on the screen is a “database error” and I have difficulty understanding logs: is this, by chance, a known bug?

Tue Dec 17 15:01:47 2019 [18068][1][DEBUG] Hook called: ::server_round_trip
Tue Dec 17 15:01:47 2019 [18068][1][DEBUG] Calling MySQLi::disconnect()
Tue Dec 17 15:01:47 2019 [18068][1][FATAL] Exception handling in /var/www/html/suitecrm/include/MVC/Controller/SugarController.php:400
Tue Dec 17 15:01:47 2019 [18068][1][FATAL] Exception in Controller: Database fallito. Si prega di fare riferimento a suitecrm.log per i dettagli.
Tue Dec 17 15:01:47 2019 [18068][1][FATAL] backtrace:
#0 /var/www/html/suitecrm/include/database/DBManager.php(353): sugar_die('Database fallit...')
#1 /var/www/html/suitecrm/include/database/DBManager.php(328): DBManager->registerError(' Query Failed: ...', ' Query Failed: ...', true)
#2 /var/www/html/suitecrm/include/database/MysqliManager.php(179): DBManager->checkError(' Query Failed: ...', true)
#3 /var/www/html/suitecrm/modules/AOS_PDF_Templates/formLetterPdf.php(62): MysqliManager->query(' SELECT  clob_c...', true)
#4 /var/www/html/suitecrm/include/MVC/Controller/SugarController.php(1020): require_once('/var/www/html/s...')
#5 /var/www/html/suitecrm/include/MVC/Controller/SugarController.php(468): SugarController->handleEntryPoint()
#6 /var/www/html/suitecrm/include/MVC/Controller/SugarController.php(373): SugarController->process()
#7 /var/www/html/suitecrm/include/MVC/SugarApplication.php(113): SugarController->execute()
#8 /var/www/html/suitecrm/index.php(52): SugarApplication->execute()
#9 {main}


We would need the rest of that query to debug. If you set your log level to DEBUG, the entire query text will probably be logged just a bit above that FATAL.

Thanks pgr.

Here is:

Tue Dec 17 15:01:47 2019 [18068][1][FATAL]  Query Failed:  SELECT  clob_clob_condizioni.* ,clob_clob_condizioni_cstm.validaa_dal_c,clob_clob_condizioni_cstm.valida_al_c,clob_clob_condizioni_cstm.fatturato_ap_c,clob_clob_condizioni_cstm.potenziale_c,clob_clob_condizioni_cstm.aos_product_categories_id_c,clob_clob_condizioni_cstm.aos_product_categories_id1_c,clob_clob_condizioni_cstm.prezzo_netto_c,clob_clob_condizioni_cstm.famiglia_c,clob_clob_condizioni_cstm.linea_c,clob_clob_condizioni_cstm.descrizione_c,clob_clob_condizioni_cstm.prezzo_c,clob_clob_condizioni_cstm.prezzo_scontato_c,clob_clob_condizioni_cstm.ricarica_grossista_c,clob_clob_condizioni_cstm.margine_grossista_c,clob_clob_condizioni_cstm.currency_id,clob_clob_condizioni_cstm.grossista_per_scheda_c , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner  , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner  , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner  , 'Users' assigned_user_name_mod, grossista , codice_prodotto  , clob_clob_anagrafica_clob_clob_condizioni_2_name, jtl5.clob_clob_f71dgrafica_ida clob_clob_f71dgrafica_ida, linea_prodotto_c , famiglia_prodotto_c  FROM clob_clob_condizioni  LEFT JOIN clob_clob_condizioni_cstm ON = clob_clob_condizioni_cstm.id_c   LEFT JOIN  users jt0 ON AND jt0.deleted=0

 AND jt0.deleted=0  LEFT JOIN  users jt1 ON AND jt1.deleted=0

 AND jt1.deleted=0  LEFT JOIN  users jt2 ON AND jt2.deleted=0

 AND jt2.deleted=0 LEFT JOIN accounts jt3 ON clob_clob_condizioni.account_id_c = AND jt3.deleted=0  LEFT JOIN aos_products jt4 ON clob_clob_condizioni.aos_products_id_c = AND jt4.deleted=0   LEFT JOIN  clob_clob_anagrafica_clob_clob_condizioni_2_c jtl5 ON AND jtl5.deleted=0

 LEFT JOIN  clob_clob_anagrafica jt5 ON AND jt5.deleted=0
 AND jt5.deleted=0 LEFT JOIN aos_product_categories jt6 ON clob_clob_condizioni_cstm.aos_product_categories_id_c = AND jt6.deleted=0  LEFT JOIN aos_product_categories jt7 ON clob_clob_condizioni_cstm.aos_product_categories_id1_c = AND jt7.deleted=0  where (( like 'B-TECH SRL%')) AND clob_clob_condizioni.deleted=0: MySQL error 1054: Unknown column '' in 'where clause'
1 Like

Thanks, this is the part with the actual error:

So what are the steps to reproduce this? Does it only happen with custom modules?

EDIT: please try a Quick Repair and Rebuild and a Rebuild relationships to see if that solves anything, though I don’t think it will

Quick Repair and Rebuild already done and not results.

This happens in the custom module (done with Builder) also with standard export pdf from listview (without changes on formLetterPdf.php).

What does it mean that he can’t find that column?
clob_clob_anagrafica_clob_clob_condizioni_2 is a relationship that I see in Studio

You would need to have a table in the database called exactly


and it would need to have a column called


If it isn’t there, there are two possibilities, and both would probably be bugs (unless you created the problem yourself by editing PHP files):

  1. Studio/Module builder isn’t making the database changes properly
  2. That query isn’t being generated correctly. I would say this one is more likely.

Hi, There ins’t.
There is instead clob_clob_anagrafica_clob_clob_condizioni_2_c which is where the data were saved…

join_clob_clob_anagrafica_clob_clob_condizioni_2_name doesn’t make sense … where does it get this name from? And what worries me most, is how I can solve the issue…

Unfortunately until I tried this export on liview, the problem could not be seen.

Now looking at the query, I begin to understand.
The error is created on a selection of records to which SuiteCRM for some reason gives the name join_clob_clob_anagrafica_clob_clob_condizioni_2_name

That like ‘B-TECH SRL%’ is a selection (a filter) on a related type field (related to clob_clob_anagrafica which is a accounts type module).

The problem is then created if you filter records and export.

In any case, I don’t know how to intervene to solve it :slight_smile:

I also don’t know where to find this, I could get there but it would take me long time, I am afraid.

If you can come up with a “minimum reproducible case” of the bug, and open a new issue on GitHub for it, I would appreciate it.

You’d have to list the exact steps you take creating a custom module (even if has only one field) and then filtering and then exporting and getting to the error.

I try to open a bug.
By the way, I confirm that the same behavior also occurs on standard modules (for example, accounts) if you apply a filter related to another accounts type module, select all filtered records and print pdf.

For completeness I add that “Select only the page” or “Select all” makes a difference.
If my filter has 35 results and I set the number of records per page out of 50, if I use the “Select page” option> print pdf IT WORKS, if I use “Select all” (despite having only one page)> print pdf IT DOESN’T WORK

1 Like