Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions htdocs/admin/usergroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
* \ingroup core
* \brief Page to setup usergroup module
*/
namespace Dolibarr\User;

// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
use Dolibarr\{ExtraFields};

/**
* @var Conf $conf
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/boxes/box_lastlogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
* \ingroup core
* \brief Module to show box of last user logins
*/
namespace Dolibarr;

include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';

use Dolibarr\ModeleBoxes;
/**
* Class to manage the box of last login
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/boxes/modules_boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \ingroup core
* \brief File containing the parent class of boxes
*/

namespace Dolibarr;

/**
* Class ModeleBoxes
Expand Down
52 changes: 52 additions & 0 deletions htdocs/core/class/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Dolibarr;

class Autoloader {

public static function register(): void {
spl_autoload_register([self::class, 'autoload']);
}

public static function autoload($class): void {
// Check that namespace is in Dolibarr
if (!str_starts_with($class, 'Dolibarr\\')) {
return;
}

$relativeClass = substr($class, strlen('Dolibarr\\'));
$relativeClassPath = str_replace('\\', DIRECTORY_SEPARATOR, $relativeClass);

$classNamespaceParts = explode('\\', $class);
$moduleName = (count($classNamespaceParts) < 3) ? '' : $classNamespaceParts[count($classNamespaceParts) - 2];

$baseDirectories = [
realpath(__DIR__) . DIRECTORY_SEPARATOR,
realpath(__DIR__) . '/../' . strtolower($moduleName) . DIRECTORY_SEPARATOR,
realpath(__DIR__ . '/../../custom/') . strtolower($moduleName) . DIRECTORY_SEPARATOR,
];

// We need to check all the possible class file names, until they all follow the correct syntax
$filePatterns = [
strtolower(basename($relativeClassPath)) . '.class.php',
basename($relativeClassPath) . '.class.php',
strtolower(basename($relativeClassPath)) . '.interface.php',
basename($relativeClassPath) . '.interface.php',
strtolower(dirname($relativeClassPath)) . '.' . strtolower(basename($relativeClassPath)) . '.class.php',
basename($relativeClassPath) . '.php'
];

foreach ($baseDirectories as $baseDir) {
foreach ($filePatterns as $pattern) {
$possiblePath = $baseDir . $pattern;
if (file_exists($possiblePath)) {
require_once $possiblePath;
return;
}
}
}
}

}

Autoloader::register();
1 change: 1 addition & 0 deletions htdocs/core/class/commonincoterm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* \ingroup core
* \brief File of the superclass of object classes that support incoterm (customer and supplier)
*/
namespace Dolibarr;


/**
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
* \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
*/
namespace Dolibarr;

require_once DOL_DOCUMENT_ROOT.'/core/class/doldeprecationhandler.class.php';
//require_once DOL_DOCUMENT_ROOT.'/core/class/doldeprecationhandler.class.php';

/**
* Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonobjectline.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* \ingroup core
* \brief File of the superclass of classes of lines of business objects (invoice, contract, proposal, orders, etc. ...)
*/

namespace Dolibarr;

/**
* Parent class for class inheritance lines of business objects
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonpeople.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* \ingroup core
* \brief File of the superclass of object classes that support people
*/

namespace Dolibarr;

/**
* Support class for third parties, contacts, members, users or resources
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonsocialnetworks.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* \ingroup core
* \brief File of the superclass of object classes that support socialnetworks
*/

namespace Dolibarr;

/**
* Superclass for social networks
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/class/conf.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* \brief File of class to manage storage of current setup
* Config is stored into file conf.php
*/
namespace Dolibarr;

use stdClass;

/**
* Class to stock current configuration
Expand Down
6 changes: 1 addition & 5 deletions htdocs/core/class/defaultvalues.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
* \file htdocs/core/class/defaultvalues.class.php
* \brief This file is a CRUD class file for DefaultValues (Create/Read/Update/Delete)
*/

// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
namespace Dolibarr;

/**
* Class for MyObject
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/doldeprecationhandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @ingroup core
* @brief trait for handling deprecated properties and methods
*/
namespace Dolibarr;

/**
* Class for handling deprecated properties and methods
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/extrafields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* \ingroup core
* \brief File of class to manage extra fields
*/

namespace Dolibarr;

/**
* Class to manage standard extra fields
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/hookmanager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \ingroup core
* \brief File of class to manage hooks
*/

namespace Dolibarr;

/**
* Class to manage hooks
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
* \brief File of class with all html predefined components
*/

namespace Dolibarr\HTML;

use stdClass;
use Dolibarr\ModeleBoxes;
/**
* Class to manage generation of HTML components
* Only common components must be here.
Expand Down
3 changes: 1 addition & 2 deletions htdocs/core/class/html.formaccounting.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
* \ingroup Accountancy (Double entries)
* \brief File of class with all html predefined components
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';


namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for accounting management
*/
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/html.formactions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/


namespace Dolibarr\HTML;
/**
* Class to manage building of HTML components
*/
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/html.formadmin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/


namespace Dolibarr\HTML;
/**
* Class to generate html code for admin pages
*/
Expand Down
3 changes: 1 addition & 2 deletions htdocs/core/class/html.formai.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
* \ingroup core
* \brief Fichier de la class permettant la generation du formulaire html d'envoi de mail unitaire
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';


namespace Dolibarr\HTML;
/**
* Class permettant la generation du formulaire html d'envoi de mail unitaire
* Usage: $formail = new FormAI($db)
Expand Down
4 changes: 1 addition & 3 deletions htdocs/core/class/html.formbank.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
* \brief File of class with all html predefined components
*/

include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';


namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for bank module
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formbarcode.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \brief Fichier de la class des functions predefinie de composants html
*/


namespace Dolibarr\HTML;
/**
* Class to manage barcode HTML
*/
Expand Down
5 changes: 1 addition & 4 deletions htdocs/core/class/html.formcategory.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
* \brief File of class to build HTML component for category filtering
*/

require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';


namespace Dolibarr\HTML;
/**
* Class to manage forms for categories
*/
Expand Down
4 changes: 1 addition & 3 deletions htdocs/core/class/html.formcompany.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
* \brief File of class to build HTML component for third parties management
*/


namespace Dolibarr\HTML;
/**
* Class to build HTML component for third parties management
* Only common components are here.
*/

require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';


/**
* Class of forms component to manage companies
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/html.formcontract.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* \brief File of class with all html predefined components
*/

namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for contract module
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formcron.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* \brief Fichier de la class des functions predefinie de composants html cron
*/


namespace Dolibarr\HTML;
/**
* Class to manage building of HTML components
*/
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/html.formexpensereport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* \brief File of class with all html predefined components
*/

namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for contract module
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formfile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* \brief File of class to offer components to list and upload files
*/


namespace Dolibarr\HTML;
/**
* Class to offer components to list and upload files
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formfiscalyear.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* \ingroup Accountancy (Double entries)
* \brief File of class with all html predefined components
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';

namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for accounting management
*/
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/html.formintervention.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* \brief File of class with all html predefined components
*/

namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for contract module
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formldap.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* \ingroup core
* \brief File of class with ldap html predefined components
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';

namespace Dolibarr\HTML;
/**
* Class to manage generation of HTML components for ldap module
*/
Expand Down
3 changes: 1 addition & 2 deletions htdocs/core/class/html.formmail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
* \ingroup core
* \brief Fichier de la class permettant la generation du formulaire html d'envoi de mail unitaire
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';


namespace Dolibarr\HTML;
/**
* Class permettant la generation du formulaire html d'envoi de mail unitaire
* Usage: $formail = new FormMail($db)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formmailing.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* \ingroup core
* \brief File of predefined functions for HTML forms for mailing module
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';

namespace Dolibarr\HTML;
/**
* Class to offer components to list and upload files
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.formmargin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* \brief Fichier de la class des functions predefinie de composants html autre
*/


namespace Dolibarr\HTML;
/**
* Class permettant la generation de composants html autre
* Only common components are here.
Expand Down
4 changes: 1 addition & 3 deletions htdocs/core/class/html.formorder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
* \brief File of predefined functions for HTML forms for order module
*/

require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';

namespace Dolibarr\HTML;
/**
* Class to manage HTML output components for orders
* Before adding component here, check they are not into common part Form.class.php
Expand Down
Loading