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/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/erp/htdocs/custom/crfact/admin/adds.php
<?php
/* crindicadores: send SMS to thirdparties by crindicadores.com
/* Copyright (C) 2012 Maxime MANGIN <maxime@tuxserv.fr>
 *
 * 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/>.
 */
 
/**
 * \file    admin/setup.php
 * \ingroup crfact
 * \brief   crfact setup page.
 *
 * Based on smsdecanet module.
 */

define('ERROR_NO_VALID_USER', "-300");
define('ERROR_USER_WRONG_LOGIN_INFO', "-301");
define('ERROR_USER_NO_VALID_SESSION', "-302");
define('ERROR_USER_ACCESS_DENIED', "-303");
define('ERROR_USER_EXISTS', "-304");
define('ERROR_DB_NO_RESULTS_FOUND', "-200");
define('ERROR_BAD_REQUEST', "-1");

define('ERROR_CLAVE_REQUEST', "-140");
define('ERROR_CONSULTAR_REQUEST', "-150");
define('ERROR_FACTURADOR_REQUEST', "-180");
define('ERROR_FILEUPLOADER_REQUEST', "-190");
define('ERROR_GENXML_REQUEST', "-191");
define('ERROR_SEND_REQUEST', "-193");
define('ERROR_SIGNXML_REQUEST', "-195");
define('ERROR_TOKEN_REQUEST', "-196");



// Load Dolibarr environment
//require(DOL_DOCUMENT_ROOT."/main.inc.php");
if (false === (@include '../../main.inc.php')) {  // From htdocs directory
	require '../../../main.inc.php'; // From "custom" directory
}

global $langs, $user;

// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once("../core/modules/modCRFact.class.php");
include_once('../class/crfact.class.php');
dol_include_once('/crfact/lib/crfact.lib.php');


// Translations
//$langs->load("admin");
$langs->load("crfact@CRFact");


// Access control
if (! $user->admin) {
	accessforbidden();
}


// Parameters
$action = GETPOST('action', 'alpha');


/*
 * Actions
 */
 

/*
 * View
 */
 
$page_name = "CRFactSetup";
llxHeader('', $langs->trans($page_name));


// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback,'title_setup');
print "<br>\n";

// Configuration header

$head=crfact_admin_prepare_head();
//dol_get_fiche_head( $head, 'settings', $langs->trans("Module500998Name"), 0, "crfact@CRFact");

dol_fiche_head($head, 'adds', $langs->trans("Module500998Name"), 0, 'crfact@CRFact');

//oJI!J%jin^M^

$var=true;

// echo '<table class="noborder" width="100%">';
// echo '<tr class="liste_title">';
// echo "  <td>".$langs->trans("CRFactAccount")."</td>";
// echo '</tr>';
// echo "<tr ".$bc[$var].">";
// echo '<td>';

// 
// 	echo $langs->trans('APIKeyNotDefined').' - (<a href="https://facapi.dps-lat.com/Facturador/adminDash/signup.html" target="_blank"><strong>'.$langs->trans('CreateAPIAcount').'</strong></a>)';
// } else {
// 	echo '<strong>Recuperar Token</strong> - (<a href="https://facapi.dps-lat.com/Facturador/forgot-password.html" target="_blank"><strong>Recuperar Token</strong></a>)';
// }
// echo '</td>';
// echo '</td>';
// echo '</table><br><br>';
	if ( $conf->global->CRFACT_USERNAME && $conf->global->CRFACT_PASSWORD && $conf->global->CRFACT_URL ){
		$crfactparam = array(
			'userName' => $conf->global->CRFACT_USERNAME,
			'pwd' => $conf->global->CRFACT_PASSWORD
		);
		$CRFact = new crfact($db);
		$response = $CRFact->Request('users','users_log_me_in',$crfactparam,$conf->global->CRFACT_URL);

		if ( $response->resp == ERROR_USER_WRONG_LOGIN_INFO ){
			$errormsg = $response->resp;
		}else{
			dolibarr_set_const($db, "CRFACT_MASTERID",$response->resp->idUser,'chaine',0,'Master ID del API CRFact',$conf->entity,0);
			dolibarr_set_const($db, "CRFACT_MASTERKEY", $response->resp->sessionKey,'chaine',0,'Password Maestro registrado en el API CRFact',$conf->entity,0);
		}
		echo '<br>'.$langs->trans('Connected').' - (<a href="https://'.parse_url($conf->global->CRFACT_URL)["host"].'/Facturador/adminDash/" target="_blank"><strong>'.$langs->trans('ViewAPIAcount').'</strong></a>)';
	}else{
		echo '<br>'.$errormsg .' - (<a href="https://'.parse_url($conf->global->CRFACT_URL)["host"].'/Facturador/adminDash/" target="_blank"><strong>'.$langs->trans('CreateAPIAcount').'</strong></a>)';
	}

	echo '<table class="noborder" width="100%">';
	echo '<tr class="liste_titre">';
	echo "  <td>".$langs->trans("GeneralInfo")."</td>\n";
	echo "  <td align=\"left\" ></td>";
	echo "  <td >&nbsp;</td></tr>";
	$var=!$var;
	echo "<tr ".$bc[$var].">";
	echo '<td>'.$langs->trans("url").'</td>';
	echo '<td align="left"><input type="text" name="crfacturl" size="50" class="flat" value="'.$conf->global->CRFACT_URL.'" disabled></td>';
	echo '<td align="right"></td>';
	echo '</tr>';
	$var=!$var;
	echo "<tr ".$bc[$var].">";
	echo '<td>'.$langs->trans("fullName").'</td>';
	echo '<td align="left"><input type="text" name="crfactfullName" size="50" class="flat" value="'.$conf->global->MAIN_INFO_SOCIETE_NOM.'" disabled></td>';
	echo '<td align="right"></td>';
	echo '</tr>';
	$var=!$var;
	echo "<tr ".$bc[$var].">";
	echo '<td>'.$langs->trans("country").'</td>';
	echo '<td align="left"><input type="text" name="crfactcountry" size="50" class="flat" value="'. $conf->global->MAIN_MONNAIE .'" disabled></td>';
	echo '<td align="right"></td>';
	echo '</tr>';
	$var=!$var;
	echo "<tr ".$bc[$var].">";
	echo '<td>'.$langs->trans("about").'</td>';
	echo '<td align="left"><input type="text" name="crfactabout" size="50" class="flat" value="'.$conf->global->MAIN_INFO_SOCIETE_TEL . ' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'" disabled></td>';
	echo '<td align="right"></td>';
	echo '</tr>';
	echo '<tr class="liste_titre">';
	echo "  <td><strong>".$errormsg."</strong></td>\n";
	echo "  <td align=\"left\" ></td>";
	echo "  <td >&nbsp;</td></tr>";
	echo '</table><br><br>';

$db->close();

// Page end
dol_get_fiche_end();
llxFooter();

?>







Hry