Change options in Bulk Action (List View)

I am trying to add a print to pdf option into the “BULK ACTION” dropdown in List View.

I cannot find the location in the code to edit this. I have managed to add it into the “Actions” button in the “Detail View”

Please could someone help me.

@epchost

Welcome to the community!

The example for module Opportunities.
Create file custom/modules/Opportunities/views/view.list.php with content:

require_once('modules/Opportunities/views/view.list.php');
class CustomOpportunitiesViewList extends OpportunitiesViewList
{
    public function preDisplay()
    {
        parent::preDisplay();
        $this->lv->actionsMenuExtraItems[]='The htmlcode of your button';
    }
}
1 Like

Hi p.konetskiy

Thanks for your reply.

I have added the code you sent and saved the file in the relevant place. Code snippet below:

However when I then navigate to the page in SuiteCRM I get the followeing error:

Do you know why this might be.

Thanks
epchost

@epchost

Check syntax. Your code:

...
$this->lv->actionsMenuExtraItems[]=''<input...
//                          double '' - should be one
...

I see that you want to use the standard function PrintPDF of SuiteCRM. I recommend to take the file modules/Contacts/views/view.list.php as an example because you should load addition javascript.

1 Like

Hola!
Consulta!
Estoy haciendo esto mismo, pero necesito que el botón de la acción que agregué, dispare una ventana modal donde se puede elegir un elemento que lo voy a relacionar con todos los que haya seleccionado del view list
Se entiende?
1ro ) No estoy pudiendo disparar el modal
2do ) Como obtengo los registros seleccionados?

Yo realice la función de mi modal en el view.list.php de la siguiente forma:

function ordenModal(){

    $modal =
    '<div id="ordenModal" class="modal fade" role="dialog">
        <div class="modal-dialog modal-ku" style="width:900px;">
            <!-- Modal content-->
            <div class="modal-content" id="ordenmodalcontent" style="padding:0%;">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Vincular OC con lineas Seleccionadas</h4>
                </div>
                <div class="modal-body" style="padding:0%;">
                    <form name="lineForm" id="linea">
                        <div class="row detail-view-row">
                            <div class="col-xs-12 col-sm-4 label col-1-label">&nbsp;</div>
                            <select id="oc_select" name="oc_select">
                                <option></option>';
                                $sql = "SELECT id, name FROM aos_contracts WHERE deleted=0 ORDER BY name ASC";
                                $res = $this->bean->db->query($sql);
                                while ($row = $this->bean->db->fetchByAssoc($res))
                                {      
                                    $modal .=  '<option style="background-color:'.$row['color_c'].'" value="'.$row['id'].'">'.$row['name'].'</option>';
                                }
    $modal.=                '</select>
                        </div></td>
                    </form>
                </div>
                <div class="modal-footer justify-content-between">
                    <!--<button type="button" id="close_modal_mov" class="btn btn-default" style="float:left;" data-dismiss="modal">Close</button> -->
                    <button type="button" id="submit_modal_mov" class="btn btn-primary" onclick="insertar_oc()">
                        Agregar
                    </button>
                </div>
            </div>
        </div>
    </div>
    ';
}

Gracias