My changes for SuiteCRM 7.11.10

It’s upgrades for SuiteCRM 7.11.10. There are some changes. The most interesting are:

  • Repair “collection” field type;
  • Make “collection_file” field type;
  • Work dropdown menu or buttons in Edit and Detail form;
  • Show system message;
  • Change design for search form;
  • and others.

Upgrade here: https://github.com/pkonetskiy/Upgrade_1_SuiteCRM_7.11.10

Best regards,
Petr

2 Likes

Interesting. Thanks for sharing!

Can you please post a few screenshots of the “collection” field type, so we can see how it works?

(if you have trouble with image uploads please see this)

There are 2 forms Editview and Detailview.

This is very interesting!

Do you think this could be a good addition to contribute to the core code, as a new feature for everybody?

Yes! It’s already a part of core code, but it’s broken there.

Everybody can use it without codding, while changing only configuration files of module (vardefs.php, editviewdefs.php, detailviewdefs.php and metadata of many-to-many link) and using standard parameters for SuiteCRM. You can see example of these in readme here: https://github.com/pkonetskiy/Upgrade_1_SuiteCRM_7.11.10/blob/master/README.md

This decision can have development in the following cases:

  • make the search functions (getSearchWhereValue, getSearchInput, getSearchViewSmarty) in file (include/SugarFields/Fields/Collection/SugarFieldCollection.php) for this field type;
  • include this field type into Studio.

I have success practice. I support SuiteCRM 7.8.2 which use this decision for more than 2 years.

And do you think you could make a PR on GitHub completing this feature? That would be very nice to have.

It’s the first experience for me to use GitHub as a public tool. Can you please give me some additional information to make it.
Would you like me to make advertisement of this decision, to push it? Or you mean that I finish files only for collection type field? Or do you mean anything else?

Maybe we can start with only the Collection type, as you learn GitHub (we’d be happy to help you!).

So you would need to

  1. clone the SuiteCRM repo. This way you get a copy of it in your own user space.

  2. Your change is going into the “hotfix-7.10.x” branch, since it is technically a bug fix, not a new feature. So you would start a new branch on your repo, from under the “hotfix-7.10.x” branch, and call the new branch for example “fix-collections”.

  3. Push your changes into that branch.

  4. Start a Pull Request from your new branch into SalesAgility’s “hotfix-7.10.x” branch.

There is a lot of GitHub documentation for all these steps, but if you run into problems just ask for our help, don’t hesitate.

Further reading:
https://docs.suitecrm.com/community/contributing-code/

1 Like

Thank you for detailed information.
I am starting.

1 Like

I have made all steps. After the last step I got link: https://github.com/salesagility/SuiteCRM/pull/8341

There are 2 messages:

  • “Review required. At least 1 approving review is required by reviewers with write access.”
  • “All checks have failed. 2 failing checks.”

I have 3 questions:

  1. I don’t understand, why the branch ‘fix-collection’ wasn’t empty?
  2. I see a lot of recommendation to change code to follow standard. The code which I changed based on the old version of SugarCRM. I am ready to spend time to change the code for standard, but I would like to be sure that this decision interesting for you. What can you say about it?

Thank you.

The (collection_file / collection )does not appear in studio. Is it suppose to?

I am unable to get the multifile upload working. I tried to follow your directions. Perhaps you could provide an example?

@johnwreford,
It isn’t supported in Studio because I only repaired standard decision of SuiteCRM.
Did you install decision (https://github.com/pkonetskiy/Upgrade_1_SuiteCRM_7.11.10) as an upgrade? What problems do you have? Are there problems with primary or secondary module? What files would you like as an example (vardefs.php, detailview.php, editview.php, metadata…php)?

Thank you for your reply.

Perhaps you could show me an example of collectionfiles in a module? All files would be awesome.

Yes I installed it as an upgrade

@johnwreford,
There is a primary module BFD_Incontracts (which you see in SuiteCRM):

part of vardefs.php

...
'fields'=>array (
...
        'bfd_filedocs_plan' => array (
            'name' => 'bfd_filedocs_plan',
            'type' => 'link',
            'relationship' => 'bfd_incontracts_plan_bfd_filedocs_collection',
            'module'=>'BFD_Filedocs',
            'bean_name'=>'BFD_Filedocs',
            'source'=>'non-db',
            'vname'=>'LBL_BFD_FILEDOCS_PLAN_COLLECTION',
        ),
        'collection_bfd_filedocs_plan' => array (
            'name' => 'collection_bfd_filedocs_plan',
            'type' => 'collection_files',
            'source'=>'non-db',
        ),
...
),

part of editviewdefs.php

...
'panels' => array (
...
            'lbl_panel_advanced3' => array (
                0 => array (
                    0 => array (
                        'name' => 'bfd_filedocs_plan',
                        'type' => 'collection_files',
                        'displayParams' => array (
                            'collection_field_list' => array(
                                array(
                                    'name' => 'filename',
                                    'displayParams' => array (
                                        'size'=>'25%',
                                    ),
                                ),
                                array(
                                    'name' => 'link_file',
                                    'displayParams' => array (
                                        'size'=>'30%',
                                    ),
                                    'type'=>'Link_file',
                                ),
                                array(
                                    'name' => 'description',
                                    'displayParams' => array (
                                        'size'=>'45%',
                                    ),
                                ),
                            ),
                        ),
                    ),
                ),
            ),
...
),

part of detailviewdefs.php

...
'panels' => array (
...
            'lbl_panel_advanced3' => array (
                0 => array (
                    0 => array (
                        'name' => 'bfd_filedocs_plan',
                        'type' => 'collection_files',
                        'label' => 'LBL_BFD_FILEDOCS_PLAN_COLLECTION_DETAILVIEW',
                        'displayParams' => array (
                            'collection_field_list' => array(
                                array(
                                    'name' => 'filename',
                                    'displayParams' => array (
                                        'size'=>'25%',
                                    ),
                                  ),
                                array(
                                    'name' => 'link_file',
                                    'displayParams' => array (
                                        'size'=>'30%',
                                    ),
                                    'type'=>'Link_file',
                                ),
                                array(
                                    'name' => 'description',
                                    'displayParams' => array (
                                        'size'=>'45%',
                                    ),
                                ),
                            ),
                        ),
                    ),
                ),
            ),
...
),
...

part of en_us.lang.php

...
    'LBL_BFD_FILEDOCS_PLAN_COLLECTION' => 'Members: <br>Add new or Delete selection',
    'LBL_BFD_FILEDOCS_PLAN_COLLECTION_DETAILVIEW' => 'Added members',
...

There is a secondary module BFD_Filedocs (hidden module):

part of vardefs.php

...
'fields'=>array (
...
        'filename' => array (
            'required' => false,
            'name' => 'filename',
            'vname' => 'LBL_FILENAME',
            'type' => 'varchar',
            'massupdate' => 0,
            'no_default' => false,
            'comments' => '',
            'help' => '',
            'importable' => 'true',
            'duplicate_merge' => 'disabled',
            'duplicate_merge_dom_value' => '0',
            'audited' => true,
            'reportable' => true,
            'unified_search' => false,
            'merge_filter' => 'disabled',
            'len' => '255',
            'size' => '20',
        ),
        'mime_type' => array (
            'required' => false,
            'name' => 'mime_type',
            'vname' => 'LBL_MIME_TYPE',
            'type' => 'varchar',
            'massupdate' => 0,
            'no_default' => false,
            'comments' => '',
            'help' => '',
            'importable' => 'true',
            'duplicate_merge' => 'disabled',
            'duplicate_merge_dom_value' => '0',
            'audited' => true,
            'reportable' => true,
            'unified_search' => false,
            'merge_filter' => 'disabled',
            'len' => '255',
            'size' => '20',
        ),
        'link_file' => array (
            'name' => 'link_file',
            'vname' => 'LBL_LINK_FILE',
            'type' => 'Link_file',
            'source'=>'non-db',
        ),
        'bfd_incontracts_plan_collection' => array (
            'name' => 'bfd_incontracts_plan_collection',
            'type' => 'link',
            'relationship' => 'bfd_incontracts_plan_bfd_filedocs_collection',
            'module'=> 'BFD_Incontracts',
            'bean_name'=>'BFD_Incontracts',
            'source'=>'non-db',
            'vname'=>'LBL_BFD_PLAN_INCONTRACTS_COLLECTION',
        ),
...
),
...
VardefManager::createVardef('BFD_Filedocs','BFD_Filedocs', array('basic','assignable','file'));

part of en_us.lang.php

...
    'LBL_FILENAME' => 'File name',
    'LBL_MIME_TYPE' => 'File type',
    'LBL_LINK_FILE' => 'Link to file',
...

There is a link many-to-many full metadata file:
bfd_incontracts_plan_bfd_filedocs_collectionMetaData.php

$dictionary["bfd_incontracts_plan_bfd_filedocs_collection"] = array (
    'bfd_incontracts_plan_bfd_filedocs_collection' => 'many-to-many',
    'relationships' => array (
        'bfd_incontracts_plan_bfd_filedocs_collection' => array (
            'rhs_module' => 'BFD_Filedocs',
            'rhs_table' => 'bfd_filedocs',
            'lhs_key' => 'id',
            'lhs_module' => 'BFD_Incontracts',
            'lhs_table' => 'bfd_incontracts',
            'rhs_key' => 'id',
            'relationship_type' => 'many-to-many',
            'join_table' => 'bfd_incontracts_plan_bfd_filedocs_collection',
            'join_key_lhs' => 'bfd_incontracts_plan_bfd_filedocs_collection_ida',
            'join_key_rhs' => 'bfd_incontracts_plan_bfd_filedocs_collection_idb',
        ),
    ),
    'table' => 'bfd_incontracts_plan_bfd_filedocs_collection',
    'fields' => array (
        0 => array (
            'name' => 'id',
            'type' => 'varchar',
            'len' => 36,
        ),
        1 => array (
            'name' => 'date_modified',
            'type' => 'datetime',
        ),
        2 => array (
            'name' => 'deleted',
            'type' => 'bool',
            'len' => '1',
            'default' => '0',
            'required' => true,
        ),
        3 => array (
            'name' => 'bfd_incontracts_plan_bfd_filedocs_collection_ida',
            'type' => 'varchar',
            'len' => 36,
        ),
        4 => array (
            'name' => 'bfd_incontracts_plan_bfd_filedocs_collection_idb',
            'type' => 'varchar',
            'len' => 36,
        ),
    ),
    'indices' => array (
        0 => array (
            'name' => 'bfd_incontracts_plan_bfd_filedocs_collectionspk',
            'type' => 'primary',
            'fields' => array (
                0 => 'id',
            ),
        ),
        1 => array (
            'name' => 'bfd_incontracts_plan_bfd_filedocs_collection_alt',
            'type' => 'alternate_key',
            'fields' => array (
                0 => 'bfd_incontracts_plan_bfd_filedocs_collection_ida',
                1 => 'bfd_incontracts_plan_bfd_filedocs_collection_idb',
            ),
        ),
    ),
);

You can use one secondary module for some primary modules. Only you should make some links many-to-many.
That is all.

1 Like