Coding guidelines

Try not to use `text` column; because it affects performance. Use varchar() with a limit instead. Only use `text` column if it's really necessary, such as storing raw shipping label data, raw image data..

For simple IF/ELSE, do NOT use CASE like this

CASE WHEN soi.product_notes IS NULL OR soi.product_notes = '' THEN NULL ELSE soi.product_notes END

Instead, is IF (if MSSQL, use IIF):

IF(soi.product_notes IS NULL OR soi.product_notes = '',NULL,soi.product_notes)

Only use CASE WHEN if there are more than one if/else branches.

<?php /**  * Frans overrides Techgroup\UspsValidation\Controller\Index\Address */

- Javascript

Each function must have documentation explaining its purpose, and one or a few usage example(s)

/**  * Frans Address Validation module for BE  * 2024/09/02 Brian created  * Usage: define('addrval', addrVal)  *  addrVal.validateAddress  */ define([     'jquery',     'ko',     'Magento_Ui/js/form/form',     'Magento_Ui/js/modal/modal',     'Frans_Framework/frans/framework/axios.min', ], function ($, ko, Component, modal, axios) {     'use strict';

- Branching rules:
When you work on a task, such as S1234, create a branch with the same name, such as branch s1234
For example, task https://plan.socalappsolutions.com/view.php?id=S1904p4 --> branch name = s1904p4
Notice that git does not work well if we name the branch with numbers only; so do NOT name it with numbers only, such as `1904`. Sometimes it works, sometimes git will throw an error because it thinks 1904 is a commit sha, not a branch name.

Make sure branches are lowercase, not uppercase. For example, branch name = s1904, not S1904

- PHP code to get table name: no need to call functions to get table name, just use string literal. Instead of 

resourceConnection->getTableName('frans_order');

Just type ‘frans_order’


Revision #16
Created 21 January 2025 00:07:20 by Brian
Updated 25 March 2026 04:25:54 by Brian