What are the files in Sugar 11 that are called orderMapping.php?

& -

Sugar 11 has added a bunch of new files in the custom directory with the name orderMapping.php. Can you explain what these files are used for? Do they get rebuilt via QRR? 

They causing havoc with Source Code Control.

Example custom/Extension/modules/Opportunities/Ext/LogicHooks/orderMapping.php

<?php
// created: 2021-03-26 10:56:52
$extensionOrderMap = array (
  'modules/Opportunities/Ext/LogicHooks/DeleteOpportunity.php' =>
  array (
    'md5' => '38db1da780d6b18f38b7cb5472758c17',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/FixWorksheetAccountAssignment.php' =>
  array (
    'md5' => '9aa1f6f0d6be9066c4f142f9af8db4ea',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/GenerateRenewalOpportunity.php' =>
  array (
    'md5' => '207fa6307d110a83eba589f7ed82082d',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/OpportunitySalesStatus.php' =>
  array (
    'md5' => 'c35c3364902925e5a15e2cc82e38062e',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/OpportunitySyncWorksheet.php' =>
  array (
    'md5' => '97276a801d4a0c4d0b40e0dca02a6ca4',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/QueuePurchaseGeneration.php' =>
  array (
    'md5' => 'de3fe02382aacc28473b01b831b74814',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/SetCommitStageForClosedWon.php' =>
  array (
    'md5' => 'bf9f44d5d332a045ceeddb7c2557ed14',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/SetForecastCommitStage.php' =>
  array (
    'md5' => '5c1669e98c87c034c284be74b061e5bf',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
  'modules/Opportunities/Ext/LogicHooks/SyncBestWorstWithLikely.php' =>
  array (
    'md5' => 'cff052a0a6215992ef2e9004f9983c36',
    'mtime' => 1612792956,
    'is_override' => false,
  ),
);

  • If I use the .gitignore you're providing (and if I'm reading correctly), those ordermapping files will be versioned, but you're telling use they shouldn't be, I guess we can agree on that being ambiguous? :)

    In general, I wonder,what do you call "generated files"? As far as I know, every time someone creates a field, or does basically anything in the studio, some files are generated (vardefs, view files, dependencies...), but we should indeed be versioning those. I'm being picky, but newer developers will be confused.

    There is a lot of confusion around the subject of versioning with this product, that's because the knowledge that some generated files should be versioned and some shouldn't only comes from trial and error, and that's not ok at all. We have a perfect example here : a new type of file appears in a new version, no one knows what to do with it. We had the same issue with role-based view files back then if I remember correctly : they are views so they should be versioned, but they're named after a technical ID that is environment-specific by nature... We figured it out, but it wasn't the best experience ever, to say the least.

    Any product or framework should provide a default .gitignore that doesn't need too much tweaking, default git hooks if needed, and developers (especially newer ones) shouldn't have to worry about making a mess in their repository by clicking a button.

    But anyway, good to know we can ignore those files, but I wonder how my client's instance will know about file orders if that order has been decided on my local instance, and the order files haven't been packaged or versioned? Will that be an issue?

  • Hi Chris,

    The .gitignore provided in developer guide was intended to just be an example. But I can make sure it gets updated to properly exclude generated orderMapping.php files.

    I think it's helpful development model to work from a Module Loadable Package like we've done with Professor M.

    https://github.com/sugarcrm/school

    That keeps your source code pristine and separate from the Sugar instance. It's also necessary anyway when developing code for SugarCloud.

    App Ecosystem @ SugarCRM

  • We have provided guidance in past that you should not be versioning generated files within source control and not something you'd want to include in Module Loadable Packages either.

    Yes true. But the only mention of the files are in the release notes. There are no mentions on where these files are stored and how they work. Thats what I was looking for. If we don't have to add them to a module loadable package that's fine but just let the documentation be clear about that its a generated file and should be treated as such.. 

  • How does this work for on-premise installs that, because of VCS, have systems where all files have the same date?

  • The first time the orderMapping is created it will do its best to place them into a particular order based upon the date. You can touch a file and remove it from the orderMapping.php to move it to the end; this will place the file at the end.

  • OK, I got around to testing this and while I am sure it fixes something it doesn't fix any of the problems I have day to day.  I explain one of my biggest language issues in this video.

    https://www.youtube.com/watch?v=Xb-7zSjJqTw

    The audio is low so you might need to turn the volume up.  Pretty much any bug that related to labels on relationships is still a big in Sugar V11.

    Problem is that it should always put the xx_xx.lang.php file at the top no matter what.  When you put the custom relationship language files first they override changes made in Studio and saved to the xx_xx.lang.php file.

    <?php
    // created: 2021-06-13 20:01:09
    $extensionOrderMap = array (
      'custom/Extension/modules/Accounts/Ext/Language/en_us.customaccounts_accounts_1.php' => 
      array (
        'md5' => '8d357aebaac0fe931d15f22d5658566b',
        'mtime' => 1623614400,
        'is_override' => false,
      ),
      'custom/Extension/modules/Accounts/Ext/Language/en_us.customaccounts_accounts_2.php' => 
      array (
        'md5' => 'e8964d384c639690c66cd92bec940bff',
        'mtime' => 1623614415,
        'is_override' => false,
      ),
      'custom/Extension/modules/Accounts/Ext/Language/en_us.lang.php' => 
      array (
        'md5' => 'e560cbfb628ea8d32d637b2b4b558479',
        'mtime' => 1623614430,
        'is_override' => false,
      ),
      'custom/Extension/modules/Accounts/Ext/Language/en_us.customaccounts_accounts_3.php' => 
      array (
        'md5' => '68a9830d27b43e24b1a087eaa5e41354',
        'mtime' => 1623614467,
        'is_override' => false,
      ),
    );

  • Hi,

    I see that in the "Development Best Practices" the "Using .gitignore Files" section has been updated, but I think they forgot about the language files. 

    It is better to change it like /custom/Extension/**/*orderMapping.php because language files have lang as a prefix.
    For more help, you can get in touch with our SugarCRM experts by dropping an email at support@rolustech.com.