187); $_result['visibility'] = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } require('../include/base.events.php'); $_morecolumns = ""; if( !isset($_id) and $id != '' ) $_id = rand(1, 100000000); $contacto = sessionget('form_editacontacto_contacto' . $_id); //logToFile('contacto: ' . print_r($contacto, true)); if( empty($_x) or in('onopen', $_x) ) { if( $id != "" and $id != "0" ) { $contacto = loadObject($Link, "crm4.contacto", $id); } else { $contacto = newObject($Link, "crm4.contacto"); //fillobjectfromrequest($contacto); } } if( isormObject($contacto) ) updateObjectFromRequest($Link, $contacto); //makeglobals($contacto, array('id', 'contacto')); if( isset($_x) ) $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); //$_initialvars['contacto'] = objectToStructure($contacto); if( isormObject($contacto) ) $_initialvars = array_merge($_initialvars, objectToStructure($contacto)); if( isormObject($contacto) ) $contacto->makeglobals(); //logToFile('contacto after uofr: ' . print_r($contacto, true)); // isbasewindow: // On Open while( ($__action == "" or $__action == "executedonopen") and (empty($_x) or in('onopen', $_x)) ) { $__action = "executedonopen"; /* if($stipo == 2 ){ $visualizarstipo='N'; }else{ $visualizarstipo='S'; } */ // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } break; } // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $__row0['__contacto__1'] = $_id ; $__row0['__contacto__2'] = $id == '0' ? 'Nuevo ' : '' ; $__row0['__razonsocial__1'] = ($stipo == 2) ? 'display: inline !important;' : 'display: none !important;' ; $__row0['__razonsocial__2'] = $contacto->razonsocial ; $__row0['__nombre__1'] = ($stipo == 1) ? 'display: inline !important;' : 'display: none !important;' ; $__row0['__nombre__2'] = $contacto->nombre ; $__row0['__apellido__1'] = ($stipo == 1) ? 'display: inline !important;' : 'display: none !important;' ; $__row0['__apellido__2'] = $contacto->apellido ; $__row0['__cargo__1'] = $stipo == 1 ? 'Cargo' : 'Relacion' ; $__row0['__cargo__2'] = $stipo == 1 ? 'Cargo' : 'Relacion' ; $__row0['__cargo__3'] = $contacto->cargo ; $_result['morevars'] = $__row0; break; } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { require_once('../include/fpdfreport.php'); $_pdf = new PDF((isset($_orientation) ? $_orientation : 'P'),'pt', (isset($_size) ? $_size : 'A4' )); $_pdf->initialPage = ($_page != '' ? $_page : 1); //$_pdf->SetAutoPageBreak(true); $_pdf->title = ""; $_pdf->SetTopMargin(50); $_pdf->AliasNbPages(); $_pdf->AddPage(); } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->title = "Contacto "; //$_pdf->drawText("Contacto ",'Arial','',14); } // aca iba session get, uofr y load/saveobject while( has($_x, 'contacto_init') ) { $_result['contacto'] = $contacto->toarray(false); break; } while( has($_x, 'contacto') ) { $contacto->saveChanges(); //if( $errors == "" ) // validatecontacto(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($contacto)); saveObject($Link, $contacto); if( hasfeature('crm4.contacto', 'procesos') ) { require_once('../include/easyflexa.php'); if( $id == 0 ) setresponsables($contacto); controlstatus($contacto); } $id = $contacto->id; //logToFile(objectToText($contacto)); if( $errors == "" ) { sqlexec($Link, "update cmcont set contacto = concat(nombre, ' ', apellido) where id = " . mysql_escape($id) . ""); redirect("contacto.php?id=$id", "_top"); // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } } if( $_redirect != "" ) redirect($_redirect); sessionset('form_editacontacto_contacto' . $_id, $contacto); if( $_result['redirect'] == '' ) redirect("?id=$id"); } break; } while( has($_x, 'contacto__delete') ) { //if( $errors == "" ) // validatecontacto(); if( $errors == "" ) { //logToFile("BEFORE SAVE: " . objectToHtml($contacto)); deleteObject($Link, $contacto); //logToFile(objectToText($contacto)); if( $_redirect != "" ) redirect($_redirect); sessionset('form_editacontacto_contacto' . $_id, null); if( $_result['redirect'] == '' ) { $_result['redirect'] = "?message=Contacto eliminado"; } } break; } while( has($_x, 'contacto_unload') ) { // Not used sessionclear('form_editacontacto_contacto' . $_id); break; } if( has($_x, 'sinnombre_1000') ) { } if( has($_x, 'unnamed1') ) { $_result['unnamed1'] = sqltoarray($Link, "1,2 Persona,Empresa", array("id", "text")); } while( has($_x, "unnamed1__onchange") ) { redirect("editacontacto.php?id=$id&stipo=$stipo"); // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } break; } if( has($_x, 'tipo_select') ) { list($_result['tipo_select'], $_result['tipo_columns'], $_result['tipo_types']) = sqltoarraydd($Link, "select tipo,tipo from cmtcont where stipo = '" . mysql_escape($stipo) . "'"); } if( $id == '' and 1 == 0 and !isset($_x) ) { $contacto->tipo = Contacto; } if( has($_x, 'razonsocial_select') ) { $_result['razonsocial_visible'] = ($stipo == 2); } if( has($_x, 'nombre_select') ) { $_result['nombre_visible'] = ($stipo == 1); } if( has($_x, 'apellido_select') ) { $_result['apellido_visible'] = ($stipo == 1); } if( has($_x, 'empresa_select') ) { list($_result['empresa_select'], $_result['empresa_columns'], $_result['empresa_types']) = sqltoarraydd($Link, "select id,contacto from cmcont where stipo='2'"); } if( has($_x, 'emails') ) { } if( $emails__row != '' ) { $contacto->emails->_selected = $emails__row; } if( has($_x, 'emails_tipoemail_select') ) { list($_result['emails_tipoemail_select'], $_result['emails_tipoemail_columns'], $_result['emails_tipoemail_types']) = sqltoarraydd($Link, "select nombre,nombre from cmtubic"); } if( has($_x, 'telefonos') ) { } if( $telefonos__row != '' ) { $contacto->telefonos->_selected = $telefonos__row; } if( has($_x, 'telefonos_tipotelefono_select') ) { list($_result['telefonos_tipotelefono_select'], $_result['telefonos_tipotelefono_columns'], $_result['telefonos_tipotelefono_types']) = sqltoarraydd($Link, "select nombre,nombre from cmtubic"); } sessionset('form_editacontacto_contacto' . $_id, $contacto); //$contacto -> ['changes'] if( isormObject($contacto) ) $contacto->makeglobals(); if( isset($_GET['_x']) and empty($_x) ) { $_result['visibility']['razonsocial'] = ($stipo == 2); } if( isset($_GET['_x']) and empty($_x) ) { $_result['visibility']['nombre'] = ($stipo == 1); } if( isset($_GET['_x']) and empty($_x) ) { $_result['visibility']['apellido'] = ($stipo == 1); } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->Output(); } ?> '); //echo(''); echo(''); ?> class="popup" >
Contacto
Datos básicos