Upgradesave development - again


I’m working on the file:


Everything looks fine now with my line items and I’d like to make the code upgrade safe.

There is already a directory:


If I put my Line_Items.php inside there and do a repair - the changes won’t affect my line items and everything is back to the default display.
Seems like
isn’t being called or so?



I don’t know the answer to that, but this is what I would try if I were you…

Check where that file is referenced, it seems to be…

/var/www/html/modules/AOS_Invoices/vardefs.php:256:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Invoices/vardefs.php:463:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

/var/www/html/modules/AOS_Contracts/vardefs.php:420:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Contracts/vardefs.php:627:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

/var/www/html/modules/AOS_Quotes/vardefs.php:346:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Quotes/vardefs.php:555:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

So, for each of those files (or only the ones relevant to you), make a custom version of that file (for example, custom/modules/AOS_Quotes/vardefs.php) and edit the reference inside it to point to your custom file:

 'include' => 'custom/modules/AOS_Products_Quotes/Line_Items.php'

… then come back here and tell us if it worked! :slight_smile:

Ok, so for


I updated both occurrences to:

'include' => 'custom/modules/AOS_Products_Quotes/Line_Items.php'

After that I did a quick repair and rebuild and pressed ctrl + F5 but SuiteCRM still shows the original Line_Items.php.
I double checked as well, that I’ve got obvious changes in my Line_Items.php
(and in the non upgradesafe folder /custom/AOS_Products_Quotes/Line_Items.php it’s working fine. )

Is this Windows or Linux? Which flavour?

And which version of SuiteCRM are you at?

2 machines:
Ubuntu 16.10, Aapache 2, PHP 7
Debian 8, Nginx, PHP 5
Issues are the same at both machines - same code though, hence I assume the issue is somewhere on my side/code side.

You say PHP 5, let’s assume it’s at least 5.5…

Ok, so maybe you could try an advanced debugging technique (one I’m going to write a blog post about, pretty soon).

Install something called auditctl. This will let you monitor specific folders and see exactly what SuiteCRM is trying to read/write, and whether it’s succeding or not.

sudo apt-get install auditd audispd-plugins

If you need to find your config file, to edit the log location, try this

find / -name auditd.conf  2>/dev/null
nano /etc/audit/auditd.conf

Now you need to add rules saying what you want to monitor. I suggest something like this (adapt to your paths, of course):

auditctl -a exit,always -F dir=/var/www/html/custom -F perm=rwa
auditctl -a exit,always -F dir=/var/www/html/modules -F perm=rwa

To list currently active rules:

auditctl -l

Now you can tail your log at the moment when you’re accessing the screens, or when you’re changing something in studio, or when you’re doing a Rebuild, to understand what’s going on:

cat /var/log/audit/audit.log | grep Line_Items.php
tail -f /var/log/audit/audit.log  | grep -i 'custom/modules/AOS_Products_Quotes'
tail -f /var/log/audit/audit.log  | grep -i 'Invoices\|Products\|Quotes'

That third example is an “OR”, it will match any of those words.

To delete ALL rules, when you’re finished, so that performance isn’t hurt in the future:

auditctl -D

With this I believe you can see “under the hood” what SuiteCRM is trying to load, including directories it is searching, before deciding to load a file. You can also detect if the problem is caused by insufficient permissions. This is a great way to get a grip on what’s wrong with some file you’re trying to customize.

Thanks for your amazing in depth explanation.
Unfortunately, with auditctl -l I can see the rules and they do have the right directories.
But less /var/log/audit/audit.log just shows a lot of entries from chromium - never anything from SuiteCRM. :dry:

Strange, there must be something wrong with the rules. Can you post your rules here so I can try them on my server?

The process doing the reading and writing should be the web server (apache or nginx). Make sure the log is writeable by everyone…

On the other hand, I see no reason why chromium (a web browser?) should be reading or writing those files, unless you were browsing the directories directly, but then no PHP would be executed at all…

I too am trying to make upgrade save changes to the AOS_Products_Quotes line items and have found that changes made in the custom directory are not being included (using the auditctl tool). Permissions are correct. What can I do now?

Hi DIanna

I have to ask to please start your own thread with your issue.

Include your versions of the software (OS, web server, PHP, SuiteCRM) and say exactly which customizations you’re trying, so I can try them on my test system.