Internal Library Deleted

I have just accidentally deleted an Internal Library under Tools->Internal Libraries->ScriptCase. Im not sure what it was called or what it does, but the only library in there now is sc_ssn.php. Is there a way to import a backup.

Also while I’m on this topic why do Internal Libraries Not support OOP. I understand that your macros libraries do not do not work in PHP Im just asking why it was not designed to work in PHP Classes.

Thanks,
Sterling Lutes

Here’s what I have there, this is a fresh install with nothing added (trail version 8). Looks like you’re missing: [SIZE=12px] sc_calc_processos.php[/SIZE]

1582dde89ea51819014b9af5d0c8edd7.png

Thanks, could you by chance copy and paste the code in that file here.

AFAIR this internal libraries are for samples purposses I think, not sure.

Also while I’m on this topic why do Internal Libraries Not support OOP. I understand that your macros libraries do not do not work in PHP Im just asking why it was not designed to work in PHP Classes.

Internal libraries are not “include”. Code is injected directly on the form/grid object. You can always uses classes and whatever you want with external libraries, you just have to take into consideration you can’t use macros inside.

So the macros do not work in the internal libraries at all? When I create a method that uses PHP or Javascript in an application why do the macros work there, what is different in that environment than in an internal library? I’m trying to understand this, I have a lot of time put in to a notification class inside an internal library that queries for the recipients and their sec_group and then sends email notifications based on their group and notification settings. None of the macros work in my code, but based on a forum I was reading yesterday it is the PHP Class that is causing the macros not to run. If you are correct, then what is the point of having Internal Libraries. Those libraries should make it easier for you to implement repeat actions across multiple applications, it just wouldn’t make sense to not support your own standard in your system.

Your problem is about classes. Internal libraies accepts macros. External Libraries no. Why? Because external are not parsed but SC parser, but internal and SC apps yes.

SC parser reads files and substitute macros by predefined code. (like globals are changed for $this->var) All events are binded AFAIR to specific functions of a SC object. I mean, internally, SC uses classes (not very good, but this is another story). When you mark an internal library, on generation, the code of the internal library is parsed and injected in the SC object. Probably, when you use a class on an “internal”, in the code generated, a class is created inside another class, and AFAIK this is not allowed.

You have several options.

  • Separate database operations from class and encapsulate on your internal (and you use your class on it).
  • Use your class on an external, and pass connection info on instantiation.

TL;TR
Macros can be used on internals
You can’t define classes on internals.
Macros can’t be used on externals
You can define classes on externals.

Thanks very helpful information, two more question if you don’t mind.

  1. Say I make an external library that holds my class, and an internal library to hold functions of SC macros. If I then include both libraries on an application could my external library class make calls to my internal library functions?

  2. Will callback functions containing SC macros work correctly? Are callbacks even needed or does SC’s macros account for fetch time in the scripts runtime.

You will enter on trouble, because to do what you want you have to include your app in your external. Pass your conn object to your class, and work with it in your class. This way your class will be portable between “php frameworks”

You can access your AdoDB conn object with

$this->Db