//echo $tipo_consulta; $res_tipo = mysql_query($tipo_consulta); $tipo = mysql_fetch_array($res_tipo); //echo $tipo['CONCEPTO_TIPO_ID']; if (!$_GET['cultivo_id']) { $sql_cul = "SELECT CULTIVO_ID FROM `p_analisis_resultados` WHERE `RECEPCION_PARTIDAS_ID` =" . $_GET["recepcion_partidas_id"]; $res_cul = mysql_query($sql_cul); $fetch_cul = mysql_fetch_object($res_cul); $cul_guardado = $fetch_cul->CULTIVO_ID; } else { $cul_guardado = $_GET['cultivo_id']; } //echo $cul_guardado; if ($tipo['CONCEPTO_TIPO_ID'] == 4) { $url = new TableEditor_URL(); $url->removeQueryString('cultivo_id'); $clearURL = $url->getURL(true); $TEMainList .= '<tr><td colspan=2>'; $TEMainList .= combo_universal_var("cultivo_id", "select CULTIVO_ID, NOMBRE from c_cultivos order by NOMBRE", $cul_guardado); $TEMainList .= '<input type=button value="ver" onclick=consulta()>'; $TEMainList .= '</td></tr>'; ?> <script language="javascript"> function consulta() { var searchStr=document.getElementById('cultivo_id').value; location.href = '<?php echo $clearURL; ?> ' + '&'+'cultivo_id=' + searchStr; }
$TEMainList .= '<th><span class="TEDefaultTit"/>' . $title . '</span></th>'; } } } // Begin - 18 Nov 2008 - Titles Icons Bg if (!empty($this->icons[$this->table]['icon'])) { foreach ($this->icons[$this->table]['icon'] as $icon => $html_icon) { $TEMainList .= '<th> </th>'; } } // End - 18 Nov 2008 - Titles Icons Bg $TEMainList .= '</tr>'; $url = new TableEditor_URL(); if (!empty($results)) { foreach ($results as $k => $row) { $url->removeQueryString('edit'); $url->addQueryString('edit', $nonFilteredData[$k][$this->pk]); $UrlEdit = $url->getURL(true); $url->removeQueryString('edit'); $url->addQueryString('view', $nonFilteredData[$k][$this->pk]); $UrlView = $url->getURL(true); $url->removeQueryString('view'); $TEMainList .= '<tr onmouseover="this.className=\'TERowOver\';" ' . ($k % 2 == 1 ? 'class="TEaltRow" onmouseout="this.className=\'TEaltRow\';"' : 'class="TERow" onmouseout="this.className=\'TERow\';"') . ' '; if (TERowOnClickEdit == false || !$this->getConfig('allowEdit')) { $TEMainList .= ' onclick="TERowHighlight(this, this.firstChild.firstChild, \'' . ($k % 2 == 1 ? 'TEaltRow' : 'TERow') . '\');"'; } elseif ($this->getConfig('allowEdit')) { $TEMainList .= 'style="cursor:pointer;"'; } $TEMainList .= '>'; if ($this->displayActionButtons()) { $TEMainList .= '<td class="TETdFieldsList">';
function displayHeader() { $headerfile = $this->getConfig('headerfile'); if ($headerfile) { require $headerfile; return; } $table = $this->table; echo '<div class="TEmainbody" align="center">'; if ($this->errors) { foreach ($this->errors as $e) { $aux_error = split(":", $e); if (strpos($aux_error[1], "Duplicate entry")) { $aux_1 = split(" ", trim($aux_error[1])); $NumberArray = count($aux_1); $aux_2 = $aux_1[5]; $aux = TEgetPrimaryKeyOf($this->table); $valor_duplicado = $aux_1[2]; $ElementDuplicate = (int) $aux_1[$NumberArray - 1]; $campo_duplicado = $aux[$ElementDuplicate]; $ArrayErrorTxt = split("'", trim($aux_error[1])); $valor_duplicado = $ArrayErrorTxt[1]; if ($campo_duplicado != "") { $RecordId = nombre_id($this->table, $campo_duplicado, str_replace("'", "", $valor_duplicado), $aux[1]); } $DuplicateErrorTxt = TEErrorDuplicateEntry . " "; $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->addQueryString('view', $RecordId); $PopupUrl = $url->getURL(true); $DuplicateErrorButton .= '<img src="' . TEImagesPath . 'TEActionView.gif" srcover="' . TEImagesPath . 'TEActionViewOver.gif" class="TEInputButton" '; if (file_exists("" . TEditorPath . "TEPopupForm.php")) { $DuplicateErrorButton .= 'onclick="TEWindowOpenPopup(\'' . $TEditorPath . 'TEPopupForm.php?table=' . $this->table . '&view=' . $RecordId . '&TEPopup=1\', \'DuplicateEntry\', \'500\', \'500\', \'0\', \'0\')" '; $DuplicateErrorButton .= 'title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } else { $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->addQueryString('view', $RecordId); $PopupUrl = $url->getURL(true); $DuplicateErrorButton .= 'onclick="TEWindowOpenPopup(\'' . $PopupUrl . '\', \'DuplicateEntry\', \'769\', \'400\', \'0\', \'1\')" title="' . TEButtonView . '" alt="' . TEButtonView . '"> '; } echo '<script language="javascript"> alert("ERROR: ' . $DuplicateErrorTxt . '\\n");</script><div class="TEditorError">ERROR: ' . $DuplicateErrorTxt . '<br>' . $DuplicateErrorButton . '</div>'; } else { echo '<script language="javascript"> alert("ERROR: ' . htmlspecialchars($e) . '"); </script><div class="TEditorError">ERROR: ' . htmlspecialchars($e) . '</div>'; } } } }
/** * Handles an add/edit page * * @param mixed $id Optional ID of row to edit */ function handleAddEditCopy($id = null) { // Quote ID if (!is_null($id)) { $id = $this->dbQuote($id); } // Form posted back if (!empty($_POST)) { // Cancel button if ($_POST['action'] == 'Cancel') { $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->removeQueryString('copy'); header('Location: ' . $url->getURL()); exit; } // OK or Apply button $useFunctions = $this->getConfig('useFunctions'); // Get fields which are "editable" foreach ($this->fields as $field => $value) { if (!empty($value['noEdit']) and !isset($value['default']) or $field == $this->pk and !$this->getConfig('allowPKEditing')) { continue; } /** * Handle default values for none editable fields */ if (!empty($value['noEdit']) and isset($value['default'])) { $unQuoted[$field] = $value['default']; $quoted[$field] = $this->dbQuote($value['default']); continue; } /** * Handle functions */ if ($useFunctions) { $function = $_POST['function'][$field]; if (!empty($function) and !empty($this->config['functions'][$function])) { $_POST[$field] = call_user_func($this->config['functions'][$function], $_POST[$field]); } } /** * Handle required fields */ if (!empty($this->fields[$field]['required']) and ($_POST[$field] === '' or !isset($_POST[$field]))) { $this->setContextualError($field, "{$this->fields[$field]['display']} is required"); } /** * Validate input based on field types */ switch ($this->fields[$field]['input']) { case 'password': if (!empty($_POST[$field . '_blank'])) { // Not much to do really } else { if (empty($_POST[$field]) and empty($_POST[$field . '_confirm'])) { continue 2; } else { if ($_POST[$field] != $_POST[$field . '_confirm']) { $this->setContextualError($field, 'Passwords entered did not match'); } } } break; case 'email': $regex = "/^([*+!.&#\$|'\\%\\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,4})\$/i"; if (!empty($_POST[$field]) and !preg_match($regex, $_POST[$field])) { $this->setContextualError($field, "Not a valid email address"); } break; case 'bitmask': $v = 0; if (!empty($_POST[$field])) { foreach ($_POST[$field] as $bit) { $v |= $bit; } } $_POST[$field] = $v; break; } /** * Handle validation callbacks */ if (!empty($this->validationCallbacks[$field])) { foreach ($this->validationCallbacks[$field] as $c) { $_POST[$field] = call_user_func($c, $this, $_POST[$field]); } } /** * Add the input to the collected data arrays */ $unQuoted[$field] = $_POST[$field]; $quoted[$field] = $this->dbQuote($_POST[$field]); /** * Add to list of fields */ $fields[] = $field; } /** * If there are any errors, show the page again */ if (!empty($this->errors) or !empty($this->contextErrors)) { $this->displayAddEditCopyPage($id); // Doesn't return } /** * Create the SET ... part of the sql query */ foreach ($fields as $f) { $sets[] = "{$f} = {$quoted[$f]}"; } $sets = implode(', ', $sets); /** * Edit specific */ if (isset($_GET['edit'])) { /** * Data filters (just in case) */ if (!empty($this->dataFilters)) { $filters = implode(' AND ', $this->dataFilters); } else { $filters = 1; } list($tables, $joinClause) = $this->getQueryTables(); $sql = "UPDATE {$tables} SET {$sets} WHERE {$joinClause} AND {$filters} AND {$this->pk} = {$id}"; $res = $this->dbQuery($sql); if (!$res) { $this->errors[] = "Failed to update row: " . $this->dbError(); } else { // Run edit callbacks if (!empty($this->editCallbacks)) { foreach ($this->editCallbacks as $c) { call_user_func($c, $unQuoted); } } } /** * Add/Copy specific */ } else { if (!empty($_GET['add']) or isset($_GET['copy'])) { $sql = "INSERT INTO {$this->table} SET {$sets}"; $res = $this->dbQuery($sql); if (!$res) { $this->errors[] = "Failed to add row: " . $this->dbError(); } else { // FIXME: Need to take into account non auto_increment primary keys $id = $this->dbGetOne("SELECT LAST_INSERT_ID()"); if (!empty($_GET['add'])) { // Run addition callbacks if (!empty($this->addCallbacks)) { foreach ($this->addCallbacks as $c) { call_user_func($c, $unQuoted); } } } else { if (isset($_GET['copy'])) { // Run copy callbacks if (!empty($this->copyCallbacks)) { foreach ($this->copyCallbacks as $c) { call_user_func($c, $unQuoted); } } } } } } } /** * Check for errors. If none, redirect if OK was pressed, otherwise * redirect back to edit page if Apply was pressed. */ if (empty($this->errors)) { if ($_POST['action'] == 'OK') { $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->removeQueryString('copy'); header('Location: ' . $url->getURL()); exit; } else { if ($_POST['action'] == 'Apply') { $url = new TableEditor_URL(); // Change to edit if this was an addition if (!empty($_GET['add']) or isset($_GET['copy'])) { $url->removeQueryString('add'); $url->removeQueryString('copy'); $url->addQueryString('edit', $id); } header('Location: ' . $url->getURL()); exit; } } } } $this->displayAddEditCopyPage($id); }
} echo '</select>'; if (!$NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->ArrayHiddenTables[$NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable']] && $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable'] && ($edit || $add)) { echo ' <img src="' . TEImagesPath . 'TEActionAdd.gif" srcover="' . TEImagesPath . 'TEActionAddOver.gif" class="TEInputButton" '; if (file_exists("" . TEditorPath . "TEPopupForm.php")) { //Url, Name, Width, Height, Align, Bars) echo 'onclick="TEWindowOpenPopup(\'' . $TEditorPath . 'TEPopupForm.php?table=' . $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable'] . '&add=1&TEPopup=1\', \'PopupAdd\', \'500\', \'500\', \'0\', \'0\')" '; echo 'title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } else { $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['LinkTable']); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); echo 'onclick="window.open(\'' . $UrlLinkAdd . '\');" title="' . TEButtonAdd . '" alt="' . TEButtonAdd . '"> '; } } } else { // para select deshabilitado $FieldValue_mostrar = ""; if ($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['values']) { foreach ($NUEVO_editor_hijo[$TABLA_HIJO["TABLA_HIJO"]]->fields[$field]['values'] as $k => $v) { if ((string) $k === $value) { //echo htmlspecialchars($k).'--'.htmlspecialchars($v) ; $FieldValue = $k;
} } </script> <?php } break; case "ban_p_bancos": if ($FieldName == "TIPO_MOV_BANCO_ID") { $FieldAction = ' OnChange="recarga_bancos_movimiento(this);" '; $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString("tipo_mov_banco_id"); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $table); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); ?> <script language="javascript"> function recarga_bancos_movimiento(elemento) { window.location = '<?php echo $UrlLinkAdd; ?> &tipo_mov_banco_id='+document.getElementsByName("TIPO_MOV_BANCO_ID")[0].value; } </script>
<?php $url = new TableEditor_URL(); $url->removeQueryString('edit'); $url->removeQueryString('add'); $url->removeQueryString('idcopy'); //if(isset($_POST["ActionRedirection"]) && (TEChangeRedirection==1)) if (isset($_POST["ActionRedirection"]) && TEChangeRedirection == 1) { $RecordId = str_replace("'", "", $id); $RedirectionUrl = $url->getURL(true); $url->addQueryString('edit', $RecordId); $RedirectionEditUrl = $url->getURL(true); $url->removeQueryString('edit'); $url->removeQueryString('idcopy'); $url->addQueryString('add', '1'); $RedirectionAddURL = $url->getURL(true); if (defined("ADD_REDIRECCION") and $add > 0) { $LocationUrl = "" . TEditorPath . "?table=" . ADD_REDIRECCION . "&" . strtolower(TEFieldKey($table)) . "=" . $RecordId; } else { if ($_POST["ActionRedirection"] == 1) { TERedirection($RedirectionUrl); exit; } if ($_POST["ActionRedirection"] == 2) { TERedirection($RedirectionEditUrl); exit; } if ($_POST["ActionRedirection"] == 3) { TERedirection($RedirectionAddURL); exit; }
function TEButtonsPreviousNext($Id, $Action) { $url = new TableEditor_URL(); $Buttons = ''; $Buttons .= '<table cellpadding="0" cellspacing="0" align="center" width="100%">'; $Buttons .= '<tr>'; $Buttons .= '<td width="50%" style="text-align:left;">'; if (TEPreviousRecord($Id)) { $url->removeQueryString($Action); $url->addQueryString($Action, TEPreviousRecord($Id)); $UrlPrevious = $url->getURL(true); $Buttons .= '<img src="' . TEImagesPath . 'TEActionPrevius.png" srcover="' . TEImagesPath . 'TEActionPreviusOver.png" class="TEInputButton" '; $Buttons .= 'onclick="document.location=\'' . $UrlPrevious . '\';" title="' . TEButtonPrevious . '" alt="' . TEButtonPrevious . '"> '; } $Buttons .= '</td>'; $Buttons .= '<td width="50%" style="text-align:right;">'; if (TENextRecord($Id)) { $url->removeQueryString($Action); $url->addQueryString($Action, TENextRecord($Id)); $UrlNext = $url->getURL(true); $Buttons .= '<img src="' . TEImagesPath . 'TEActionNext.png" srcover="' . TEImagesPath . 'TEActionNextOver.png" class="TEInputButton" '; $Buttons .= 'onclick="document.location=\'' . $UrlNext . '\';" title="' . TEButtonNext . '" alt="' . TEButtonNext . '"> '; } $Buttons .= '</td>'; $Buttons .= '</tr>'; $Buttons .= '</table>'; return $Buttons; }
} echo '<input type="radio" name="ActionRedirection" id="ActionRedirection" value="1" ' . $aux_1 . '>Ver todos los registros'; echo ' <input type="radio" name="ActionRedirection" id="ActionRedirection" value="2" ' . $aux_2 . '>Editar este registro'; echo ' <input type="radio" name="ActionRedirection" id="ActionRedirection" value="3" ' . $aux_3 . '>Agregar otro registro'; echo '</td>'; echo '</tr>'; } echo '<tr>'; echo '<td colspan="3" align="center">'; $url = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $url->removeQueryString($TxtRemove); $url->removeQueryString("importa_tabla"); $url->removeQueryString("importa_id"); $okURL = $url->getURL(false); if ($edit) { $url->addQueryString('view', $edit); $ViewURL = $url->getURL(true); $url->removeQueryString('view'); } $url->addQueryString('add', '1'); $AddURL = $url->getURL(false); $url->removeQueryString('add'); if ($edit) { $Copy = "idcopy"; $url->addQueryString($Copy, $edit); $CopyURL = $url->getURL(false);
<?php //if($edit>0 || $add>0) if ($table == "cip") { if ($edit > 0) { $URL_cip = new TableEditor_URL(); $URL_cip->removeQueryString("menu_opcion"); $URL_cip->removeQueryString($table); $URL_cip = $URL_cip->getURL(true); if ($menu_opcion == "") { $menu_opcion = "datos"; } $menu = array(array($URL_cip . "&menu_opcion=datos", "Datos", $menu_opcion == "datos"), array($URL_cip . "&menu_opcion=pi", "Pedido Interno", $menu_opcion == "pi"), array($URL_cip . "&menu_opcion=oc", "OC", $menu_opcion == "oc"), array($URL_cip . "&menu_opcion=facturacion", "Facturacion", $menu_opcion == "facturacion"), array($URL_cip . "&menu_opcion=entregas", "Entregas", $menu_opcion == "entregas"), array($URL_cip . "&menu_opcion=comisiones", "Comisiones", $menu_opcion == "comisiones"), array($URL_cip . "&menu_opcion=garantias", "Garantias", $menu_opcion == "garantias")); muestra_menu_interno($menu); } else { } }
$("[id=tr_PM_HORA_SALIDA_DESTINO_2]").slideDown(); } } </script> <?php } if ($FieldName == "SERVICIO") { $FieldAction = ' OnChange="recarga_tipo_servicio(this);" '; $UrlLinkAdd = new TableEditor_URL(); if ($edit) { $TxtRemove = 'edit'; } elseif ($add == 1) { $TxtRemove = 'add'; } $UrlLinkAdd->removeQueryString($TxtRemove); $UrlLinkAdd->removeQueryString("servicio"); $UrlLinkAdd->removeQueryString($table); $UrlLinkAdd->addQueryString('table', $table); $UrlLinkAdd->addQueryString('add', '1'); $UrlLinkAdd = $UrlLinkAdd->getURL(true); ?> <script language="javascript"> function recarga_tipo_servicio(elemento) { window.location = '<?php echo $UrlLinkAdd; ?> &servicio='+document.getElementsByName("SERVICIO")[0].value; } </script>
function consulta() { var searchStr=document.getElementById('cuenta_id').value; location.href = '<?php echo $clearURL; ?> ' + '&'+'cuenta_id=' + searchStr; } </script> <?php break; case "_sample_vta_p_facturas": $url = new TableEditor_URL(); $url->removeQueryString('folio_fiscal'); $nuevoURL = $url->getURL(true); $url_detalle = new TableEditor_URL(); $url_detalle->removeQueryString('table'); $url_detalle->addQueryString('table', "_sample_vta_p_facturas_detalle"); $nuevoURL_detalle = $url_detalle->getURL(true); $TEMainList .= '<tr><td colspan=2>'; $TEMainList .= '<input name="folio_fiscal" type text>'; $TEMainList .= '<input type=button value="Buscar factura" onclick=consulta()>'; $TEMainList .= '</td><td colspan=2>'; $TEMainList .= '<input name="buscar_en_partidas" type text>'; $TEMainList .= '<input type=button value="Buscar en partidas" onclick=consulta_partidas()>'; $TEMainList .= '</td></tr>'; ?> <script language="javascript"> function consulta() { var searchStr=document.getElementById('folio_fiscal').value; location.href = '<?php