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/erp/htdocs/custom/crfact/core/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/erp/htdocs/custom/crfact/core/modules/modCRFact.class.php
<?php
/* Copyright (C) 2017  Josep Lluís Amador <joseplluis@lliuretic.cat>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * \defgroup    mymodule    MyModule module
 * \brief       MyModule module descriptor.
 *
 * Put detailed description here.
 */

/**
 * \file        core/modules/modCRFat.class.php
 * \ingroup     crfact
 * \brief       Module for send XML by CRFact.
 *
 * Put detailed description here.
 */

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


	
/**
 * Description and activation class for module SmsPubli
 */
class modCRFact extends DolibarrModules
{
	/** @var DoliDB Database handler */
	public $db;
	public $numero = 500998;
	public $rights_class = 'CRFact';
	public $family = 'financial';
	public $module_position = 500;
	public $name = "Facturacion MH CR";	
	public $description = "Integracion de la facturacion v4.3 para MH";
	public $descriptionlong = "Generador de Comporbantes fiscales para<br />
	                           Ministerio de Hacienda.";
	public $editor_name = "Randall Mora";
	public $editor_url = "https://www.dps-lat.com";
	public $version = '1.0';
	public $const_name = 'MAIN_MODULE_CRFACT';
	public $picto = 'bill';


	/** @var array Define module parts */
	public $module_parts = array(
		'crfact' => true,
		'triggers' => true,
		'login' => false,
		'substitutions' => false,
		'menus' => false,
		'theme' => false,
		'tpl' => false,
		'barcode' => false,
		'models' => false,
		'hooks' => array('data'=>array('admincompany','login','mainloginpage','mail','invoicecard','propalcard','ordercard','thirdpartycard','emailcollectorcard','notification','productcard','invoicesuppliercard','pdfgeneration'),'entity'=>0),
		'dir' => array(),
		'workflow' => array(),
	);
 
	public $config_page_url = 'setup.php@crfact';
	
	public $hidden = false; /** @var bool Control module visibility */
	public $depends = array('always'=>'modFacture'); /** @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(13, 1); /** @var int[] Minimum Dolibarr version required by this module */

	public $langfiles = array('crfact@crfact');
	
	
	/** @var array Indexed list of constants options */
	public $const = array(
	);
	
	//		0 => array(
	//		'MAIN_SMS_SENDMODE', /** @var string Constant name */
	//		'chaine',
	//		'smspubli', /** @var string Constant initial value */
	//		'SMS send mode with SMS Publi', /** @var string Constant description */
	//		false, /** @var bool Constant visibility */
	//		'current', /* Multi-company entities: 'current' or 'allentities' */
	//		false /** @var bool Delete constant when module is disabled */
	//	)
	
	public $tabs = array();
	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(
			0 => 50099801,
			1 => 'PUT XML',
			3 => 0,
			4 => 'put'
		);
		
		// // Menu entries
		// $this->menu[]=array(
		// 	'fk_menu'=>'fk_mainmenu=tools',
		// 	'type'=>'left',
		// 	'title'=>'PutFact',
		// 	'mainmenu'=>'tools',
		// 	'leftmenu'=>'crfact',
		// 	'url'=>'/crfact/get.php',
		// 	'langs'=>'crfact@crfact',
		// 	'position'=>100,
		// 	'enabled'=>'$conf->crfact->enabled',
		// 	'perms'=>'$user->rights->crfact->put',
		// 	'target'=>'',
		// 	'user'=>0
		// );

	}
	


	
	/**
	 * 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;

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

		$sql = array();

		$this->db->query('CREATE TABLE '.MAIN_DB_PREFIX.'crfact_actividades (
			-- BEGIN MODULEBUILDER FIELDS
			rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
			date_creation datetime NOT NULL,
			codigo varchar(6) DEFAULT NULL,
			descripcion varchar(150) DEFAULT NULL,
			estado char(1) DEFAULT NULL
			-- END MODULEBUILDER FIELDS
		) ENGINE=innodb;');

		$this->db->query('ALTER TABLE '.MAIN_DB_PREFIX.'facture 
			MODIFY COLUMN date_valid datetime ;');

		$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('/smspubli/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_CRFACT%"';
		//$sql[] = 'DELETE FROM '.MAIN_DB_PREFIX.'const WHERE name LIKE "CRFACT%"';
		return $this->_remove($sql, $options);
	}
	
}

?>

Hry