db = $db;
$this->doli_version = DOL_VERSION;
$this->parametros_iniciaes();
}
public function parametros_iniciaes(){
global $conf;
}
function cfdimx_admin_prepare_head(){
global $conf;
if(count($this->datos_emisor) == 0){
$this->getEmisor();
}
$validacion_rfc = ($this->datos_emisor["MAIN_INFO_SIREN"] != "" ? 1 : 0);
$validacion_razon_social = ($this->datos_emisor["CFDIMX_RAZON_SOCIAL"] != "" ? 1 : 0);
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=dataEmisor';
$head[$h][1] = "Emisor";
$head[$h][2] = "uno";
$h++;
if($validacion_rfc == 1 && $validacion_razon_social == 1){
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=config';
$head[$h][1] = "Web Services";
$head[$h][2] = "dos";
$h++;
// $head[$h][0] = DOL_URL_ROOT.'/cfdimx/admin/cfdimx.php?mod=emisores';
// $head[$h][1] = "Emisores";
// $head[$h][2] = "tres";
// $h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=retenciones';
$head[$h][1] = "Ret. Locales";
$head[$h][2] = "cinco";
$h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=formaspago';
$head[$h][1] = "Formas de Pago";
$head[$h][2] = "seis";
$h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=factura';
$head[$h][1] = "Factura";
$head[$h][2] = "siete";
$h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=complemento_pago';
$head[$h][1] = "Complemento de Pagos";
$head[$h][2] = "ocho";
$h++;
// $head[$h][0] = DOL_URL_ROOT.'/cfdimx/admin/cfdimx.php?mod=configopcional';
// $head[$h][1] = "Ajustes Opcionales";
// $head[$h][2] = "nueve";
// $h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=cargamasivaclaves';
$head[$h][1] = "Carga Masiva";
$head[$h][2] = "diez";
$h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php',1 ).'?mod=updatedatos_doli';
$head[$h][1] = "Información Dolibarr";
$head[$h][2] = "once";
$h++;
}
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=recursos';
$head[$h][1] = "Recursos";
$head[$h][2] = "doce";
$h++;
$head[$h][0] = dol_buildpath('/cfdimx/admin/cfdimx.php', 1).'?mod=changelog';
$head[$h][1] = "ChangeLog";
$head[$h][2] = "cien";
$h++;
return $head;
}
function getSelected( $v1, $v2 ){
if( $v1==$v2 ){
return "selected";
}else{
return "";
}
}
public function obtener_catalogo($selected='', $htmlname='', $tipo_catalogo, $tipo_informacion = 0, $tipo_sql = '', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $entrepot=0){
global $conf,$user,$langs;
$db = $this->db;
$lista_claves_doli[] = array( "id" => 1, "etiqueta" => "Clave Producto/Servicio");
$lista_claves_doli[] = array( "id" => 2, "etiqueta" => "Unidad de Medida");
$lista_claves_doli[] = array( "id" => 3, "etiqueta" => "No. Identificación");
$lista_claves_doli[] = array( "id" => 4, "etiqueta" => "Objeto de Impuesto");
// If no preselected user defined, we take current user
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
$excludeUsers=null;
$includeUsers=null;
// Permettre l’exclusion d’utilisateurs
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
// Permettre l’inclusion d’utilisateurs
if (is_array($include)) $includeUsers = implode("','",$include);
else if ($include == 'hierarchy')
{
// Build list includeUsers to have only hierarchy
$userid=$user->id;
$include=array();
if (empty($user->users) || ! is_array($user->users)) $user->get_full_tree();
foreach($user->users as $key => $val)
{
if (preg_match('/'.$userid.'/',$val['fullpath'])) $include[]=$val['id'];
}
$includeUsers = implode("','",$include);
}
$out='';
$valor_placeholder = "";
switch ($tipo_catalogo) {
case 1:
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."c_cfdimx_pais WHERE active = 1";
$valor_placeholder = "País";
break;
case 2:
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."c_cfdimx_regimen_f WHERE active = 1";
$valor_placeholder = "Régimen Fiscal";
break;
case 3:
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."c_cfdimx_husoh WHERE active = 1";
$valor_placeholder = "Huso Horario";
break;
case 4:
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."c_cfdimx_husoh WHERE active = 1 LIMIT 1";
$valor_placeholder = "Catálogo";
break;
case 5:
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product";
$valor_placeholder = "Producto";
break;
case 6:
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product WHERE rowid = 0";
$valor_placeholder = "Nuevo Valor";
break;
default:
$sql = "";
break;
}
if($tipo_informacion == 1)
// $sql .= " AND code='".$selected."'";
$resql = "";
$resql = $db->query($sql);
// print $sql;
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$etiqueta = "";
if ($num)
{
// Enhance with select2
$nodatarole='';
if ($conf->use_javascript_ajax)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname);
$out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
}
if($tipo_catalogo == 5){
$out.= '