Expensereport Card.php

Hello, Pls I need help

I created a file from the core (expensereport/card.php) to custom directory to add a little function to it.

After testing ti and its working, I discovered that dolibarr doesn’t pick up that custom directory path.

From the expense report card.php, if you click the enter button, it would take you to …expensereport/payment/payment.php, however, I want the link to be custom/expensereport/payment/payment.php so I can see the file where I added that function.

I had changed the url also in card.php to the url of the custom directly, yet dolibarr didn’t pick it, it still defaults to the core rather than the custom

Can anyone help with a solution? I tried but its not linking except I add custom to the url directly in the browser url

Hoping to hear from anyone

Thank you

I think I need a little bit more information. Like which Dolibarr version? And what are you trying to create? A module?

Is it something generally valuable to more people? or just for you?

You could potentially add a Complementary Attribute in in the configuration of the module expense reports. This could just be a single link to your other function.

Thank you Jon,

Its been a while,

Well it depends on what and how people use it.

What was to be achieved is we tied bank accounts to business locations and Expense report too business location. The aim is when expense is paid , its tied to a location.

But what is to be achieved is Bank to pay from should also be list of Bank accounts tied to that location rather than all the the bank accounts so selection would be easier and its financial entry is tied around the location

Is it clearer now?

So right now it works, but the problem is when I click on the enter payment button in card.php (expensereport) rather than taking me to custom/expensereport/payment/payment.php where the bank to debit is, it takes me still to Dolibarr core (the link is hardcoded in card.php), changing that url for DoPayment to the custom url still didn’t work, it still loaded the core url

Is it clearer now?

it is a little bit more clear.

I can see the value in different locations having their own expense reports and payments.

How do you create/store those locations inside dolibarr?

we used extrafields to create business locations and tied them to Warehouse location and Administrative Location (Establishment in HRM)

Then we tied users to either of those locations and store in the DB - Actually from the extrafield, it didnt store on the DB, though on the cards the assigned locations were stored against the user or bank. So we wrote an update kind of query to use to store those info into the extrafield table holding the linkage information fot the locations

Dos this help?

I am still looking for the solution as asked earlier

Thank you

Greetings,

Pls anyone with an idea of what to do on this?

Still trying to redirect to my custom directory path

Hi @Absmachin

You sent an email about this issue and requested me to take a look. The first thing I noticed is that you modified the core Dolibarr code directly, which is not a recommended practice for any Dolibarr developer.

Regarding the issue you mentioned, if you changed the URL path (href) directly in the card page and pointed it to /custom/, it should redirect there. However, you need to ensure that you’ve modified the correct part of the code and placed it in the right position/place/file.

Beyond this, it’s hard to say much without inspecting the live system, as such issues often require direct debugging. If you’re familiar with PHP and Dolibarr development, I’d strongly recommend implementing this via a custom module instead.

Thanks a& Regards
Saikat Koley
Software Developer(Dolibarr)
Call/WhatsApp : +919903256573

Email : saikatkoley@hotmail.com
https://www.linkedin.com/in/saikatkoley/

Thank you for reaching out.

Just to clarify, I don’t tamper with the core dolibarr file, I moved the file (expenserport/card.php) to custom directory, same as Payment/payment.php - Both are in custom/expensereport/card.php and custom/expensereport/payment/payment.php respectively, its here I changed the href in card.php that points to payment.php, but it still loaded core dolibarr file rather than the custom

Is it clearer now and why would I have such a challenge?

@Absmachin First, let me know where it’s being loaded from, because simply placing the card file in the custom folder won’t work. The global functions that point to that file will still reference the original path in the core directory.

To make it work, you’d need to write redirection logic that routes the user from the original file to your custom one. But again, this isn’t a recommended approach, because it either requires modifying the main card file or altering the specific function responsible for the path resolution (if you’re familiar with Dolibarr, you probably know which function I’m referring to).

Although I’ll suggest again to develop a custom module to achieve the requirement, as it will be upgrade-safe and cleaner in the long run.

Anyway, best of luck!

Thanks & Regards
Saikat Koley
Software Developer(Dolibarr)
Call/WhatsApp : +919903256573

Email : saikatkoley@hotmail.com
https://www.linkedin.com/in/saikatkoley/

Thanks for the feedback

It loads from the core from the beginning of the creation of expense report up till card.php when the enter payment button is to be used, upon clicking, I expect that the url now changed from pointing to the core to the custom would load the custom payment.php file, but it still loads the core payment.php file

This is the main issue

Maybe I will try to see to the custom module, not sure I know how to do that though, but if there is no other way, then that way I have to go

Thanks

@Absmachin Read this Module development - Dolibarr ERP CRM Wiki

Best of luck.

Thanks & Regards
Saikat Koley
Software Developer(Dolibarr)
Call/WhatsApp : +919903256573

Email : saikatkoley@hotmail.com
https://www.linkedin.com/in/saikatkoley/