function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check if valid key values for master user
     if ($Security->CurrentUserID() != "" && !$Security->IsAdmin()) {
         // Non system admin
         $sMasterFilter = $this->SqlMasterFilter_hoja_mantenimientos();
         if (strval($this->id_hoja_mantenimeinto->CurrentValue) != "" && $this->getCurrentMasterTable() == "hoja_mantenimientos") {
             $sMasterFilter = str_replace("@codigo@", ew_AdjustSql($this->id_hoja_mantenimeinto->CurrentValue), $sMasterFilter);
         } else {
             $sMasterFilter = "";
         }
         if ($sMasterFilter != "") {
             $rsmaster = $GLOBALS["hoja_mantenimientos"]->LoadRs($sMasterFilter);
             $this->MasterRecordExists = $rsmaster && !$rsmaster->EOF;
             if (!$this->MasterRecordExists) {
                 $sMasterUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedMasterUserID"));
                 $sMasterUserIdMsg = str_replace("%f", $sMasterFilter, $sMasterUserIdMsg);
                 $this->setFailureMessage($sMasterUserIdMsg);
                 return FALSE;
             } else {
                 $rsmaster->Close();
             }
         }
         $sMasterFilter = $this->SqlMasterFilter_tipo_gastos();
         if (strval($this->id_tipo_gasto->CurrentValue) != "" && $this->getCurrentMasterTable() == "tipo_gastos") {
             $sMasterFilter = str_replace("@codigo@", ew_AdjustSql($this->id_tipo_gasto->CurrentValue), $sMasterFilter);
         } else {
             $sMasterFilter = "";
         }
         if ($sMasterFilter != "") {
             $rsmaster = $GLOBALS["tipo_gastos"]->LoadRs($sMasterFilter);
             $this->MasterRecordExists = $rsmaster && !$rsmaster->EOF;
             if (!$this->MasterRecordExists) {
                 $sMasterUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedMasterUserID"));
                 $sMasterUserIdMsg = str_replace("%f", $sMasterFilter, $sMasterUserIdMsg);
                 $this->setFailureMessage($sMasterUserIdMsg);
                 return FALSE;
             } else {
                 $rsmaster->Close();
             }
         }
     }
     // Set up foreign key field value from Session
     if ($this->getCurrentMasterTable() == "hoja_mantenimientos") {
         $this->id_hoja_mantenimeinto->CurrentValue = $this->id_hoja_mantenimeinto->getSessionValue();
     }
     if ($this->getCurrentMasterTable() == "tipo_gastos") {
         $this->id_tipo_gasto->CurrentValue = $this->id_tipo_gasto->getSessionValue();
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // detalle
     $this->detalle->SetDbValueDef($rsnew, $this->detalle->CurrentValue, NULL, FALSE);
     // fecha
     $this->fecha->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha->CurrentValue, 7), NULL, FALSE);
     // id_tipo_gasto
     $this->id_tipo_gasto->SetDbValueDef($rsnew, $this->id_tipo_gasto->CurrentValue, NULL, FALSE);
     // id_hoja_mantenimeinto
     $this->id_hoja_mantenimeinto->SetDbValueDef($rsnew, $this->id_hoja_mantenimeinto->CurrentValue, NULL, FALSE);
     // id_usuario
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['id_usuario'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->codigo->setDbValue($conn->Insert_ID());
         $rsnew['codigo'] = $this->codigo->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Example #2
0
 function ParentUserIDList($userid)
 {
     $result = "";
     // Own record
     if (trim(strval($userid)) == strval(CurrentUserID())) {
         if (strval(CurrentParentUserID()) != "") {
             $result = ew_QuotedValue(CurrentParentUserID(), EW_DATATYPE_NUMBER);
         }
         return $result;
     }
     // One level only, must be CurrentUserID
     if (!EW_USER_ID_IS_HIERARCHICAL) {
         return ew_QuotedValue(CurrentUserID(), EW_DATATYPE_NUMBER);
     } else {
         // Hierarchical, all users except userid
         $ar = $this->UserID;
         $len = count($ar);
         for ($i = 0; $i < $len; $i++) {
             if (strval($ar[$i]) != trim(strval($userid))) {
                 if ($result != "") {
                     $result .= ", ";
                 }
                 $result .= ew_QuotedValue($ar[$i], EW_DATATYPE_NUMBER);
             }
         }
         return $result;
     }
 }
Example #3
0
 function RenderEditRow()
 {
     global $conn, $Security, $gsLanguage, $Language;
     // Call Row Rendering event
     $this->Row_Rendering();
     // id
     $this->id->EditAttrs["class"] = "form-control";
     $this->id->EditCustomAttributes = "";
     $this->id->EditValue = $this->id->CurrentValue;
     $this->id->ViewCustomAttributes = "";
     // url
     $this->url->EditAttrs["class"] = "form-control";
     $this->url->EditCustomAttributes = "";
     $this->url->EditValue = ew_HtmlEncode($this->url->CurrentValue);
     $this->url->PlaceHolder = ew_RemoveHtml($this->url->FldCaption());
     // tdate
     $this->tdate->EditAttrs["class"] = "form-control";
     $this->tdate->EditCustomAttributes = "";
     $this->tdate->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->tdate->CurrentValue, 5));
     $this->tdate->PlaceHolder = ew_RemoveHtml($this->tdate->FldCaption());
     // account_id
     $this->account_id->EditAttrs["class"] = "form-control";
     $this->account_id->EditCustomAttributes = "";
     if (!$Security->IsAdmin() && $Security->IsLoggedIn() && !$this->UserIDAllow("info")) {
         // Non system admin
         $this->account_id->CurrentValue = CurrentUserID();
         $this->account_id->EditValue = $this->account_id->CurrentValue;
         $this->account_id->ViewCustomAttributes = "";
     } else {
         $this->account_id->EditValue = ew_HtmlEncode($this->account_id->CurrentValue);
         $this->account_id->PlaceHolder = ew_RemoveHtml($this->account_id->FldCaption());
     }
     // Call Row Rendered event
     $this->Row_Rendered();
 }
Example #4
0
 function RenderEditRow()
 {
     global $conn, $Security, $gsLanguage, $Language;
     // Call Row Rendering event
     $this->Row_Rendering();
     // id
     $this->id->EditAttrs["class"] = "form-control";
     $this->id->EditCustomAttributes = "";
     $this->id->EditValue = $this->id->CurrentValue;
     $this->id->ViewCustomAttributes = "";
     // account_id
     $this->account_id->EditAttrs["class"] = "form-control";
     $this->account_id->EditCustomAttributes = "";
     if (!$Security->IsAdmin() && $Security->IsLoggedIn() && !$this->UserIDAllow("info")) {
         // Non system admin
         $this->account_id->CurrentValue = CurrentUserID();
         $this->account_id->EditValue = $this->account_id->CurrentValue;
         $this->account_id->ViewCustomAttributes = "";
     } else {
         $this->account_id->EditValue = ew_HtmlEncode($this->account_id->CurrentValue);
         $this->account_id->PlaceHolder = ew_RemoveHtml($this->account_id->FldCaption());
     }
     // image
     $this->image->EditAttrs["class"] = "form-control";
     $this->image->EditCustomAttributes = "";
     $this->image->EditValue = ew_HtmlEncode($this->image->CurrentValue);
     $this->image->PlaceHolder = ew_RemoveHtml($this->image->FldCaption());
     // uname
     $this->uname->EditAttrs["class"] = "form-control";
     $this->uname->EditCustomAttributes = "";
     $this->uname->EditValue = ew_HtmlEncode($this->uname->CurrentValue);
     $this->uname->PlaceHolder = ew_RemoveHtml($this->uname->FldCaption());
     // dtime
     $this->dtime->EditAttrs["class"] = "form-control";
     $this->dtime->EditCustomAttributes = "";
     $this->dtime->EditValue = ew_HtmlEncode($this->dtime->CurrentValue);
     $this->dtime->PlaceHolder = ew_RemoveHtml($this->dtime->FldCaption());
     // pnumber
     $this->pnumber->EditAttrs["class"] = "form-control";
     $this->pnumber->EditCustomAttributes = "";
     $this->pnumber->EditValue = $this->pnumber->CurrentValue;
     $this->pnumber->ViewCustomAttributes = "";
     // message
     $this->message->EditAttrs["class"] = "form-control";
     $this->message->EditCustomAttributes = "";
     $this->message->EditValue = ew_HtmlEncode($this->message->CurrentValue);
     $this->message->PlaceHolder = ew_RemoveHtml($this->message->FldCaption());
     // m_type
     $this->m_type->EditAttrs["class"] = "form-control";
     $this->m_type->EditCustomAttributes = "";
     $this->m_type->EditValue = ew_HtmlEncode($this->m_type->CurrentValue);
     $this->m_type->PlaceHolder = ew_RemoveHtml($this->m_type->FldCaption());
     // M_url
     $this->M_url->EditCustomAttributes = "";
     $arwrk = array();
     $arwrk[] = array($this->M_url->FldTagValue(1), $this->M_url->FldTagCaption(1) != "" ? $this->M_url->FldTagCaption(1) : $this->M_url->FldTagValue(1));
     $arwrk[] = array($this->M_url->FldTagValue(2), $this->M_url->FldTagCaption(2) != "" ? $this->M_url->FldTagCaption(2) : $this->M_url->FldTagValue(2));
     $this->M_url->EditValue = $arwrk;
     // Call Row Rendered event
     $this->Row_Rendered();
 }
Example #5
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Begin transaction
     if ($this->getCurrentDetailTable() != "") {
         $conn->BeginTrans();
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // cuit_cuil
     $this->cuit_cuil->SetDbValueDef($rsnew, $this->cuit_cuil->CurrentValue, NULL, FALSE);
     // id_actividad
     $this->id_actividad->SetDbValueDef($rsnew, $this->id_actividad->CurrentValue, NULL, FALSE);
     // propietario
     $this->propietario->SetDbValueDef($rsnew, $this->propietario->CurrentValue, NULL, FALSE);
     // comercio
     $this->comercio->SetDbValueDef($rsnew, $this->comercio->CurrentValue, NULL, FALSE);
     // direccion_comercio
     $this->direccion_comercio->SetDbValueDef($rsnew, $this->direccion_comercio->CurrentValue, NULL, FALSE);
     // mail
     $this->mail->SetDbValueDef($rsnew, $this->mail->CurrentValue, NULL, FALSE);
     // tel
     $this->tel->SetDbValueDef($rsnew, $this->tel->CurrentValue, NULL, FALSE);
     // cel
     $this->cel->SetDbValueDef($rsnew, $this->cel->CurrentValue, NULL, FALSE);
     // activo
     $this->activo->SetDbValueDef($rsnew, $this->activo->CurrentValue, NULL, FALSE);
     // socio_nro
     // id_usuario
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['id_usuario'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->socio_nro->setDbValue($conn->Insert_ID());
         $rsnew['socio_nro'] = $this->socio_nro->DbValue;
     }
     // Add detail records
     if ($AddRow) {
         $DetailTblVar = explode(",", $this->getCurrentDetailTable());
         if (in_array("socios_detalles", $DetailTblVar) && $GLOBALS["socios_detalles"]->DetailAdd) {
             $GLOBALS["socios_detalles"]->id_socio->setSessionValue($this->socio_nro->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["socios_detalles_grid"])) {
                 $GLOBALS["socios_detalles_grid"] = new csocios_detalles_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["socios_detalles_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["socios_detalles"]->id_socio->setSessionValue("");
             }
             // Clear master key if insert failed
         }
         if (in_array("socios_cuotas", $DetailTblVar) && $GLOBALS["socios_cuotas"]->DetailAdd) {
             $GLOBALS["socios_cuotas"]->id_socio->setSessionValue($this->socio_nro->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["socios_cuotas_grid"])) {
                 $GLOBALS["socios_cuotas_grid"] = new csocios_cuotas_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["socios_cuotas_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["socios_cuotas"]->id_socio->setSessionValue("");
             }
             // Clear master key if insert failed
         }
         if (in_array("deudas", $DetailTblVar) && $GLOBALS["deudas"]->DetailAdd) {
             $GLOBALS["deudas"]->id_socio->setSessionValue($this->socio_nro->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["deudas_grid"])) {
                 $GLOBALS["deudas_grid"] = new cdeudas_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["deudas_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["deudas"]->id_socio->setSessionValue("");
             }
             // Clear master key if insert failed
         }
     }
     // Commit/Rollback transaction
     if ($this->getCurrentDetailTable() != "") {
         if ($AddRow) {
             $conn->CommitTrans();
             // Commit transaction
         } else {
             $conn->RollbackTrans();
             // Rollback transaction
         }
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Example #6
0
 function AddRow($rsold = NULL)
 {
     global $Language, $Security;
     $conn =& $this->Connection();
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // NAME_IN_CARD
     $this->NAME_IN_CARD->SetDbValueDef($rsnew, $this->NAME_IN_CARD->CurrentValue, "", FALSE);
     // NUMBER
     $this->NUMBER->SetDbValueDef($rsnew, $this->NUMBER->CurrentValue, 0, FALSE);
     // CARD_TYPE_ID
     $this->CARD_TYPE_ID->SetDbValueDef($rsnew, $this->CARD_TYPE_ID->CurrentValue, 0, FALSE);
     // BANK_ID
     $this->BANK_ID->SetDbValueDef($rsnew, $this->BANK_ID->CurrentValue, 0, FALSE);
     // VALID_THRU_MONTH
     $this->VALID_THRU_MONTH->SetDbValueDef($rsnew, $this->VALID_THRU_MONTH->CurrentValue, 0, FALSE);
     // VALID_THRU_YEAR
     $this->VALID_THRU_YEAR->SetDbValueDef($rsnew, $this->VALID_THRU_YEAR->CurrentValue, 0, FALSE);
     // USER_ID
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['USER_ID'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             // Get insert id if necessary
             $this->CARD_ID->setDbValue($conn->Insert_ID());
             $rsnew['CARD_ID'] = $this->CARD_ID->DbValue;
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Example #7
0
 function WriteAuditTrailOnAdd(&$rs)
 {
     if (!$this->AuditTrailOnAdd) {
         return;
     }
     $table = 'montos';
     // Get key value
     $key = "";
     if ($key != "") {
         $key .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"];
     }
     $key .= $rs['id'];
     // Write Audit Trail
     $dt = ew_StdCurrentDateTime();
     $id = ew_ScriptName();
     $usr = CurrentUserID();
     foreach (array_keys($rs) as $fldname) {
         if ($this->fields[$fldname]->FldDataType != EW_DATATYPE_BLOB) {
             // Ignore BLOB fields
             if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) {
                 if (EW_AUDIT_TRAIL_TO_DATABASE) {
                     $newvalue = $rs[$fldname];
                 } else {
                     $newvalue = "[MEMO]";
                 }
                 // Memo Field
             } elseif ($this->fields[$fldname]->FldDataType == EW_DATATYPE_XML) {
                 $newvalue = "[XML]";
                 // XML Field
             } else {
                 $newvalue = $rs[$fldname];
             }
             ew_WriteAuditTrail("log", $dt, $id, $usr, "A", $table, $fldname, $key, "", $newvalue);
         }
     }
 }
Example #8
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check if valid User ID
     $bValidUser = FALSE;
     if ($Security->CurrentUserID() != "" && !$Security->IsAdmin()) {
         // Non system admin
         $bValidUser = $Security->IsValidUserID($this->codigo->CurrentValue);
         if (!$bValidUser) {
             $sUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedUserID"));
             $sUserIdMsg = str_replace("%u", $this->codigo->CurrentValue, $sUserIdMsg);
             $this->setFailureMessage($sUserIdMsg);
             return FALSE;
         }
     }
     // Check if valid parent user id
     $bValidParentUser = FALSE;
     if ($Security->CurrentUserID() != "" && !$Security->IsAdmin()) {
         // Non system admin
         $bValidParentUser = $Security->IsValidUserID($this->codigo->CurrentValue);
         if (!$bValidParentUser) {
             $sParentUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedParentUserID"));
             $sParentUserIdMsg = str_replace("%p", $this->codigo->CurrentValue, $sParentUserIdMsg);
             $this->setFailureMessage($sParentUserIdMsg);
             return FALSE;
         }
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // usuario
     $this->usuario->SetDbValueDef($rsnew, $this->usuario->CurrentValue, NULL, FALSE);
     // contrasenia
     $this->contrasenia->SetDbValueDef($rsnew, $this->contrasenia->CurrentValue, NULL, FALSE);
     // nombre
     $this->nombre->SetDbValueDef($rsnew, $this->nombre->CurrentValue, NULL, FALSE);
     // email
     $this->_email->SetDbValueDef($rsnew, $this->_email->CurrentValue, NULL, FALSE);
     // activo
     $this->activo->SetDbValueDef($rsnew, $this->activo->CurrentValue, NULL, FALSE);
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->codigo->setDbValue($conn->Insert_ID());
         $rsnew['codigo'] = $this->codigo->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
         // Call User Registered event
         $this->User_Registered($rsnew);
     }
     return $AddRow;
 }
Example #9
0
 function RenderEditRow()
 {
     global $conn, $Security, $gsLanguage, $Language;
     // Call Row Rendering event
     $this->Row_Rendering();
     // id
     $this->id->EditAttrs["class"] = "form-control";
     $this->id->EditCustomAttributes = "";
     $this->id->EditValue = $this->id->CurrentValue;
     $this->id->ViewCustomAttributes = "";
     // status
     $this->status->EditAttrs["class"] = "form-control";
     $this->status->EditCustomAttributes = "";
     $this->status->EditValue = ew_HtmlEncode($this->status->CurrentValue);
     $this->status->PlaceHolder = ew_RemoveHtml($this->status->FldCaption());
     // account_id
     $this->account_id->EditAttrs["class"] = "form-control";
     $this->account_id->EditCustomAttributes = "";
     if (!$Security->IsAdmin() && $Security->IsLoggedIn() && !$this->UserIDAllow("info")) {
         // Non system admin
         $this->account_id->CurrentValue = CurrentUserID();
         $this->account_id->EditValue = $this->account_id->CurrentValue;
         $this->account_id->ViewCustomAttributes = "";
     } else {
         $this->account_id->EditValue = ew_HtmlEncode($this->account_id->CurrentValue);
         $this->account_id->PlaceHolder = ew_RemoveHtml($this->account_id->FldCaption());
     }
     // profile_pix
     $this->profile_pix->EditAttrs["class"] = "form-control";
     $this->profile_pix->EditCustomAttributes = "";
     $this->profile_pix->EditValue = ew_HtmlEncode($this->profile_pix->CurrentValue);
     $this->profile_pix->PlaceHolder = ew_RemoveHtml($this->profile_pix->FldCaption());
     // autoreply
     $this->autoreply->EditAttrs["class"] = "form-control";
     $this->autoreply->EditCustomAttributes = "";
     $this->autoreply->EditValue = ew_HtmlEncode($this->autoreply->CurrentValue);
     $this->autoreply->PlaceHolder = ew_RemoveHtml($this->autoreply->FldCaption());
     // phonenumber
     $this->phonenumber->EditAttrs["class"] = "form-control";
     $this->phonenumber->EditCustomAttributes = "";
     $this->phonenumber->EditValue = ew_HtmlEncode($this->phonenumber->CurrentValue);
     $this->phonenumber->PlaceHolder = ew_RemoveHtml($this->phonenumber->FldCaption());
     // Call Row Rendered event
     $this->Row_Rendered();
 }
Example #10
0
    ?>
<input type="hidden" name="z_id" id="z_id" value="="></p>
		</label>
		<div class="<?php 
    echo $usuario_search->SearchRightColumnClass;
    ?>
"><div<?php 
    echo $usuario->id->CellAttributes();
    ?>
>
			<span id="el_usuario_id">
<?php 
    if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
        // Non system admin
        if (strval($usuario->id->AdvancedSearch->SearchValue) == "") {
            $usuario->id->AdvancedSearch->SearchValue = CurrentUserID();
        }
        ?>
<select data-field="x_id" id="x_id" name="x_id"<?php 
        echo $usuario->id->EditAttributes();
        ?>
>
<?php 
        if (is_array($usuario->id->EditValue)) {
            $arwrk = $usuario->id->EditValue;
            if ($arwrk[0][0] != "") {
                echo "<option value=\"\">" . $Language->Phrase("PleaseSelect") . "</option>";
            }
            $rowswrk = count($arwrk);
            $emptywrk = TRUE;
            for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
Example #11
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Begin transaction
     if ($this->getCurrentDetailTable() != "") {
         $conn->BeginTrans();
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // fecha_ini
     $this->fecha_ini->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_ini->CurrentValue, 7), NULL, FALSE);
     // id_cliente
     $this->id_cliente->SetDbValueDef($rsnew, $this->id_cliente->CurrentValue, NULL, FALSE);
     // id_localidad_origen
     $this->id_localidad_origen->SetDbValueDef($rsnew, $this->id_localidad_origen->CurrentValue, NULL, FALSE);
     // Origen
     $this->Origen->SetDbValueDef($rsnew, $this->Origen->CurrentValue, NULL, FALSE);
     // id_localidad_destino
     $this->id_localidad_destino->SetDbValueDef($rsnew, $this->id_localidad_destino->CurrentValue, NULL, FALSE);
     // Destino
     $this->Destino->SetDbValueDef($rsnew, $this->Destino->CurrentValue, NULL, FALSE);
     // Km_ini
     $this->Km_ini->SetDbValueDef($rsnew, $this->Km_ini->CurrentValue, NULL, FALSE);
     // estado
     $this->estado->SetDbValueDef($rsnew, $this->estado->CurrentValue, NULL, strval($this->estado->CurrentValue) == "");
     // id_vehiculo
     $this->id_vehiculo->SetDbValueDef($rsnew, $this->id_vehiculo->CurrentValue, NULL, FALSE);
     // id_tipo_carga
     $this->id_tipo_carga->SetDbValueDef($rsnew, $this->id_tipo_carga->CurrentValue, NULL, FALSE);
     // km_fin
     $this->km_fin->SetDbValueDef($rsnew, $this->km_fin->CurrentValue, NULL, FALSE);
     // fecha_fin
     $this->fecha_fin->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_fin->CurrentValue, 7), NULL, FALSE);
     // adelanto
     $this->adelanto->SetDbValueDef($rsnew, $this->adelanto->CurrentValue, NULL, strval($this->adelanto->CurrentValue) == "");
     // kg_carga
     $this->kg_carga->SetDbValueDef($rsnew, $this->kg_carga->CurrentValue, NULL, strval($this->kg_carga->CurrentValue) == "");
     // tarifa
     $this->tarifa->SetDbValueDef($rsnew, $this->tarifa->CurrentValue, NULL, strval($this->tarifa->CurrentValue) == "");
     // porcentaje
     $this->porcentaje->SetDbValueDef($rsnew, $this->porcentaje->CurrentValue, NULL, strval($this->porcentaje->CurrentValue) == "");
     // id_usuario
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['id_usuario'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->codigo->setDbValue($conn->Insert_ID());
         $rsnew['codigo'] = $this->codigo->DbValue;
     }
     // Add detail records
     if ($AddRow) {
         $DetailTblVar = explode(",", $this->getCurrentDetailTable());
         if (in_array("gastos", $DetailTblVar) && $GLOBALS["gastos"]->DetailAdd) {
             $GLOBALS["gastos"]->id_hoja_ruta->setSessionValue($this->codigo->CurrentValue);
             // Set master key
             if (!isset($GLOBALS["gastos_grid"])) {
                 $GLOBALS["gastos_grid"] = new cgastos_grid();
             }
             // Get detail page object
             $AddRow = $GLOBALS["gastos_grid"]->GridInsert();
             if (!$AddRow) {
                 $GLOBALS["gastos"]->id_hoja_ruta->setSessionValue("");
             }
             // Clear master key if insert failed
         }
     }
     // Commit/Rollback transaction
     if ($this->getCurrentDetailTable() != "") {
         if ($AddRow) {
             $conn->CommitTrans();
             // Commit transaction
         } else {
             $conn->RollbackTrans();
             // Rollback transaction
         }
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Example #12
0
 function RenderEditRow()
 {
     global $Security, $gsLanguage, $Language;
     // Call Row Rendering event
     $this->Row_Rendering();
     // CARD_ID
     $this->CARD_ID->EditAttrs["class"] = "form-control";
     $this->CARD_ID->EditCustomAttributes = "";
     $this->CARD_ID->EditValue = $this->CARD_ID->CurrentValue;
     $this->CARD_ID->ViewCustomAttributes = "";
     // NAME_IN_CARD
     $this->NAME_IN_CARD->EditAttrs["class"] = "form-control";
     $this->NAME_IN_CARD->EditCustomAttributes = "";
     $this->NAME_IN_CARD->EditValue = $this->NAME_IN_CARD->CurrentValue;
     $this->NAME_IN_CARD->PlaceHolder = ew_RemoveHtml($this->NAME_IN_CARD->FldCaption());
     // NUMBER
     $this->NUMBER->EditAttrs["class"] = "form-control";
     $this->NUMBER->EditCustomAttributes = "";
     $this->NUMBER->EditValue = $this->NUMBER->CurrentValue;
     $this->NUMBER->PlaceHolder = ew_RemoveHtml($this->NUMBER->FldCaption());
     if (strval($this->NUMBER->EditValue) != "" && is_numeric($this->NUMBER->EditValue)) {
         $this->NUMBER->EditValue = ew_FormatNumber($this->NUMBER->EditValue, -2, -1, -2, 0);
     }
     // CARD_TYPE_ID
     $this->CARD_TYPE_ID->EditAttrs["class"] = "form-control";
     $this->CARD_TYPE_ID->EditCustomAttributes = "";
     // USER_ID
     $this->USER_ID->EditAttrs["class"] = "form-control";
     $this->USER_ID->EditCustomAttributes = "";
     if (!$Security->IsAdmin() && $Security->IsLoggedIn() && !$this->UserIDAllow("info")) {
         // Non system admin
         $this->USER_ID->CurrentValue = CurrentUserID();
         $this->USER_ID->EditValue = $this->USER_ID->CurrentValue;
         $this->USER_ID->ViewCustomAttributes = "";
     } else {
         $this->USER_ID->EditValue = $this->USER_ID->CurrentValue;
         $this->USER_ID->PlaceHolder = ew_RemoveHtml($this->USER_ID->FldCaption());
     }
     // BANK_ID
     $this->BANK_ID->EditAttrs["class"] = "form-control";
     $this->BANK_ID->EditCustomAttributes = "";
     // VALID_THRU_MONTH
     $this->VALID_THRU_MONTH->EditAttrs["class"] = "form-control";
     $this->VALID_THRU_MONTH->EditCustomAttributes = "";
     $this->VALID_THRU_MONTH->EditValue = $this->VALID_THRU_MONTH->CurrentValue;
     $this->VALID_THRU_MONTH->PlaceHolder = ew_RemoveHtml($this->VALID_THRU_MONTH->FldCaption());
     // VALID_THRU_YEAR
     $this->VALID_THRU_YEAR->EditAttrs["class"] = "form-control";
     $this->VALID_THRU_YEAR->EditCustomAttributes = "";
     $this->VALID_THRU_YEAR->EditValue = $this->VALID_THRU_YEAR->CurrentValue;
     $this->VALID_THRU_YEAR->PlaceHolder = ew_RemoveHtml($this->VALID_THRU_YEAR->FldCaption());
     // Call Row Rendered event
     $this->Row_Rendered();
 }
 function RenderEditRow()
 {
     global $Security, $gsLanguage, $Language;
     // Call Row Rendering event
     $this->Row_Rendering();
     // RESERVATION_ID
     $this->RESERVATION_ID->EditAttrs["class"] = "form-control";
     $this->RESERVATION_ID->EditCustomAttributes = "";
     $this->RESERVATION_ID->EditValue = $this->RESERVATION_ID->CurrentValue;
     $this->RESERVATION_ID->ViewCustomAttributes = "";
     // CODE
     $this->CODE->EditAttrs["class"] = "form-control";
     $this->CODE->EditCustomAttributes = "";
     $this->CODE->EditValue = $this->CODE->CurrentValue;
     $this->CODE->PlaceHolder = ew_RemoveHtml($this->CODE->FldCaption());
     // DESCRIPTION
     $this->DESCRIPTION->EditAttrs["class"] = "form-control";
     $this->DESCRIPTION->EditCustomAttributes = "";
     $this->DESCRIPTION->EditValue = $this->DESCRIPTION->CurrentValue;
     $this->DESCRIPTION->PlaceHolder = ew_RemoveHtml($this->DESCRIPTION->FldCaption());
     // TIME_LIMIT
     $this->TIME_LIMIT->EditAttrs["class"] = "form-control";
     $this->TIME_LIMIT->EditCustomAttributes = "";
     $this->TIME_LIMIT->EditValue = $this->TIME_LIMIT->CurrentValue;
     $this->TIME_LIMIT->PlaceHolder = ew_RemoveHtml($this->TIME_LIMIT->FldCaption());
     if (strval($this->TIME_LIMIT->EditValue) != "" && is_numeric($this->TIME_LIMIT->EditValue)) {
         $this->TIME_LIMIT->EditValue = ew_FormatNumber($this->TIME_LIMIT->EditValue, -2, -1, -2, 0);
     }
     // TICKET_NUMBER_TIME_LIMIT
     $this->TICKET_NUMBER_TIME_LIMIT->EditAttrs["class"] = "form-control";
     $this->TICKET_NUMBER_TIME_LIMIT->EditCustomAttributes = "";
     $this->TICKET_NUMBER_TIME_LIMIT->EditValue = $this->TICKET_NUMBER_TIME_LIMIT->CurrentValue;
     $this->TICKET_NUMBER_TIME_LIMIT->PlaceHolder = ew_RemoveHtml($this->TICKET_NUMBER_TIME_LIMIT->FldCaption());
     if (strval($this->TICKET_NUMBER_TIME_LIMIT->EditValue) != "" && is_numeric($this->TICKET_NUMBER_TIME_LIMIT->EditValue)) {
         $this->TICKET_NUMBER_TIME_LIMIT->EditValue = ew_FormatNumber($this->TICKET_NUMBER_TIME_LIMIT->EditValue, -2, -1, -2, 0);
     }
     // TICKET_NUMBER
     $this->TICKET_NUMBER->EditAttrs["class"] = "form-control";
     $this->TICKET_NUMBER->EditCustomAttributes = "";
     $this->TICKET_NUMBER->EditValue = $this->TICKET_NUMBER->CurrentValue;
     $this->TICKET_NUMBER->PlaceHolder = ew_RemoveHtml($this->TICKET_NUMBER->FldCaption());
     if (strval($this->TICKET_NUMBER->EditValue) != "" && is_numeric($this->TICKET_NUMBER->EditValue)) {
         $this->TICKET_NUMBER->EditValue = ew_FormatNumber($this->TICKET_NUMBER->EditValue, -2, -1, -2, 0);
     }
     // RESERVATION_STATUS_ID
     $this->RESERVATION_STATUS_ID->EditAttrs["class"] = "form-control";
     $this->RESERVATION_STATUS_ID->EditCustomAttributes = "";
     $this->RESERVATION_STATUS_ID->EditValue = $this->RESERVATION_STATUS_ID->CurrentValue;
     $this->RESERVATION_STATUS_ID->PlaceHolder = ew_RemoveHtml($this->RESERVATION_STATUS_ID->FldCaption());
     // ADITIONAL_INFO
     $this->ADITIONAL_INFO->EditAttrs["class"] = "form-control";
     $this->ADITIONAL_INFO->EditCustomAttributes = "";
     $this->ADITIONAL_INFO->EditValue = $this->ADITIONAL_INFO->CurrentValue;
     $this->ADITIONAL_INFO->PlaceHolder = ew_RemoveHtml($this->ADITIONAL_INFO->FldCaption());
     // DATETIME
     $this->DATETIME->EditAttrs["class"] = "form-control";
     $this->DATETIME->EditCustomAttributes = "";
     $this->DATETIME->EditValue = ew_FormatDateTime($this->DATETIME->CurrentValue, 7);
     $this->DATETIME->PlaceHolder = ew_RemoveHtml($this->DATETIME->FldCaption());
     // USER_ID
     $this->USER_ID->EditAttrs["class"] = "form-control";
     $this->USER_ID->EditCustomAttributes = "";
     if (!$Security->IsAdmin() && $Security->IsLoggedIn() && !$this->UserIDAllow("info")) {
         // Non system admin
         $this->USER_ID->CurrentValue = CurrentUserID();
         $this->USER_ID->EditValue = $this->USER_ID->CurrentValue;
         $this->USER_ID->ViewCustomAttributes = "";
     } else {
         $this->USER_ID->EditValue = $this->USER_ID->CurrentValue;
         $this->USER_ID->PlaceHolder = ew_RemoveHtml($this->USER_ID->FldCaption());
     }
     // Call Row Rendered event
     $this->Row_Rendered();
 }
Example #14
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // Titulo
     $this->Titulo->SetDbValueDef($rsnew, $this->Titulo->CurrentValue, NULL, FALSE);
     // Descripcion
     $this->Descripcion->SetDbValueDef($rsnew, $this->Descripcion->CurrentValue, NULL, FALSE);
     // fecha
     $this->fecha->SetDbValueDef($rsnew, ew_CurrentDate(), NULL);
     $rsnew['fecha'] =& $this->fecha->DbValue;
     // id_usuario
     $this->id_usuario->SetDbValueDef($rsnew, CurrentUserID(), NULL);
     $rsnew['id_usuario'] =& $this->id_usuario->DbValue;
     // archivo
     if (!$this->archivo->Upload->KeepFile) {
         $this->archivo->Upload->DbValue = "";
         // No need to delete old file
         if ($this->archivo->Upload->FileName == "") {
             $rsnew['archivo'] = NULL;
         } else {
             $rsnew['archivo'] = $this->archivo->Upload->FileName;
         }
     }
     // estado
     $this->estado->SetDbValueDef($rsnew, $this->estado->CurrentValue, NULL, FALSE);
     if (!$this->archivo->Upload->KeepFile) {
         $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
         if (!ew_Empty($this->archivo->Upload->FileName)) {
             $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
             $FileCount = count($NewFiles);
             for ($i = 0; $i < $FileCount; $i++) {
                 $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
                 if ($NewFiles[$i] != "") {
                     $file = $NewFiles[$i];
                     if (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file)) {
                         if (!in_array($file, $OldFiles)) {
                             $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file);
                             // Get new file name
                             if ($file1 != $file) {
                                 // Rename temp file
                                 while (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1)) {
                                     // Make sure did not clash with existing upload file
                                     $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file1, TRUE);
                                 }
                                 // Use indexed name
                                 rename(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1);
                                 $NewFiles[$i] = $file1;
                             }
                         }
                     }
                 }
             }
             $this->archivo->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles);
             $rsnew['archivo'] = $this->archivo->Upload->FileName;
         } else {
             $NewFiles = array();
         }
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             if (!$this->archivo->Upload->KeepFile) {
                 $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
                 if (!ew_Empty($this->archivo->Upload->FileName)) {
                     $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
                     $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['archivo']);
                     $FileCount = count($NewFiles);
                     for ($i = 0; $i < $FileCount; $i++) {
                         $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
                         if ($NewFiles[$i] != "") {
                             $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i];
                             if (file_exists($file)) {
                                 $this->archivo->Upload->SaveToFile($this->archivo->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i);
                                 // Just replace
                             }
                         }
                     }
                 } else {
                     $NewFiles = array();
                 }
                 $FileCount = count($OldFiles);
                 for ($i = 0; $i < $FileCount; $i++) {
                     if ($OldFiles[$i] != "" && !in_array($OldFiles[$i], $NewFiles)) {
                         @unlink(ew_UploadPathEx(TRUE, $this->archivo->OldUploadPath) . $OldFiles[$i]);
                     }
                 }
             }
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->codigo->setDbValue($conn->Insert_ID());
         $rsnew['codigo'] = $this->codigo->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     // archivo
     ew_CleanUploadTempPath($this->archivo, $this->archivo->Upload->Index);
     return $AddRow;
 }
Example #15
0
function ew_Info()
{
    global $Security;
    ew_WritePaths();
    echo "CurrentUserName() = " . CurrentUserName() . "<br>";
    echo "CurrentUserID() = " . CurrentUserID() . "<br>";
    echo "CurrentParentUserID() = " . CurrentParentUserID() . "<br>";
    echo "IsLoggedIn() = " . (IsLoggedIn() ? "TRUE" : "FALSE") . "<br>";
    echo "IsAdmin() = " . (IsAdmin() ? "TRUE" : "FALSE") . "<br>";
    echo "IsSysAdmin() = " . (IsSysAdmin() ? "TRUE" : "FALSE") . "<br>";
    if (isset($Security)) {
        $Security->ShowUserLevelInfo();
    }
}
Example #16
0
 function WriteAuditTrailOnDelete(&$rs)
 {
     if (!$this->AuditTrailOnDelete) {
         return;
     }
     $table = 'usuario';
     // Get key value
     $key = "";
     if ($key != "") {
         $key .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"];
     }
     $key .= $rs['id'];
     // Write Audit Trail
     $dt = ew_StdCurrentDateTime();
     $id = ew_ScriptName();
     $curUser = CurrentUserID();
     foreach (array_keys($rs) as $fldname) {
         if (array_key_exists($fldname, $this->fields) && $this->fields[$fldname]->FldDataType != EW_DATATYPE_BLOB) {
             // Ignore BLOB fields
             if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) {
                 if (EW_AUDIT_TRAIL_TO_DATABASE) {
                     $oldvalue = $rs[$fldname];
                 } else {
                     $oldvalue = "[MEMO]";
                 }
                 // Memo field
             } elseif ($this->fields[$fldname]->FldDataType == EW_DATATYPE_XML) {
                 $oldvalue = "[XML]";
                 // XML field
             } else {
                 $oldvalue = $rs[$fldname];
             }
             ew_WriteAuditTrail("log", $dt, $id, $curUser, "D", $table, $fldname, $key, $oldvalue, "");
         }
     }
 }
Example #17
0
 function RenderRow()
 {
     global $conn, $Security, $Language;
     global $gsLanguage;
     // Initialize URLs
     // Call Row_Rendering event
     $this->Row_Rendering();
     // Common render codes for all row types
     // id
     // url
     // tdate
     // account_id
     if ($this->RowType == EW_ROWTYPE_VIEW) {
         // View row
         // id
         $this->id->ViewValue = $this->id->CurrentValue;
         $this->id->ViewCustomAttributes = "";
         // url
         $this->url->ViewValue = $this->url->CurrentValue;
         $this->url->ViewCustomAttributes = "";
         // account_id
         $this->account_id->ViewValue = $this->account_id->CurrentValue;
         $this->account_id->ViewCustomAttributes = "";
         // id
         $this->id->LinkCustomAttributes = "";
         $this->id->HrefValue = "";
         $this->id->TooltipValue = "";
         // url
         $this->url->LinkCustomAttributes = "";
         $this->url->HrefValue = "";
         $this->url->TooltipValue = "";
         // account_id
         $this->account_id->LinkCustomAttributes = "";
         $this->account_id->HrefValue = "";
         $this->account_id->TooltipValue = "";
     } elseif ($this->RowType == EW_ROWTYPE_EDIT) {
         // Edit row
         // id
         $this->id->EditAttrs["class"] = "form-control";
         $this->id->EditCustomAttributes = "";
         $this->id->EditValue = $this->id->CurrentValue;
         $this->id->ViewCustomAttributes = "";
         // url
         $this->url->EditAttrs["class"] = "form-control";
         $this->url->EditCustomAttributes = "";
         $this->url->EditValue = ew_HtmlEncode($this->url->CurrentValue);
         $this->url->PlaceHolder = ew_RemoveHtml($this->url->FldCaption());
         // account_id
         $this->account_id->EditAttrs["class"] = "form-control";
         $this->account_id->EditCustomAttributes = "";
         if (!$Security->IsAdmin() && $Security->IsLoggedIn() && !$this->UserIDAllow("edit")) {
             // Non system admin
             $this->account_id->CurrentValue = CurrentUserID();
             $this->account_id->EditValue = $this->account_id->CurrentValue;
             $this->account_id->ViewCustomAttributes = "";
         } else {
             $this->account_id->EditValue = ew_HtmlEncode($this->account_id->CurrentValue);
             $this->account_id->PlaceHolder = ew_RemoveHtml($this->account_id->FldCaption());
         }
         // Edit refer script
         // id
         $this->id->HrefValue = "";
         // url
         $this->url->HrefValue = "";
         // account_id
         $this->account_id->HrefValue = "";
     }
     if ($this->RowType == EW_ROWTYPE_ADD || $this->RowType == EW_ROWTYPE_EDIT || $this->RowType == EW_ROWTYPE_SEARCH) {
         // Add / Edit / Search row
         $this->SetupFieldTitles();
     }
     // Call Row Rendered event
     if ($this->RowType != EW_ROWTYPE_AGGREGATEINIT) {
         $this->Row_Rendered();
     }
 }
Example #18
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // account_id
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['account_id'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"];
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->id->setDbValue($conn->Insert_ID());
         $rsnew['id'] = $this->id->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Example #19
0
 function WriteAuditTrailDummy($typ)
 {
     $table = 'deudas';
     $usr = CurrentUserID();
     ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $typ, $table, "", "", "", "");
 }
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check if valid key values for master user
     if ($Security->CurrentUserID() != "" && !$Security->IsAdmin()) {
         // Non system admin
         $sMasterFilter = $this->SqlMasterFilter_detalles();
         if (strval($this->id_detalles->CurrentValue) != "" && $this->getCurrentMasterTable() == "detalles") {
             $sMasterFilter = str_replace("@codigo@", ew_AdjustSql($this->id_detalles->CurrentValue), $sMasterFilter);
         } else {
             $sMasterFilter = "";
         }
         if ($sMasterFilter != "") {
             $rsmaster = $GLOBALS["detalles"]->LoadRs($sMasterFilter);
             $this->MasterRecordExists = $rsmaster && !$rsmaster->EOF;
             if (!$this->MasterRecordExists) {
                 $sMasterUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedMasterUserID"));
                 $sMasterUserIdMsg = str_replace("%f", $sMasterFilter, $sMasterUserIdMsg);
                 $this->setFailureMessage($sMasterUserIdMsg);
                 return FALSE;
             } else {
                 $rsmaster->Close();
             }
         }
         $sMasterFilter = $this->SqlMasterFilter_socios();
         if (strval($this->id_socio->CurrentValue) != "" && $this->getCurrentMasterTable() == "socios") {
             $sMasterFilter = str_replace("@socio_nro@", ew_AdjustSql($this->id_socio->CurrentValue), $sMasterFilter);
         } else {
             $sMasterFilter = "";
         }
         if ($sMasterFilter != "") {
             $rsmaster = $GLOBALS["socios"]->LoadRs($sMasterFilter);
             $this->MasterRecordExists = $rsmaster && !$rsmaster->EOF;
             if (!$this->MasterRecordExists) {
                 $sMasterUserIdMsg = str_replace("%c", CurrentUserID(), $Language->Phrase("UnAuthorizedMasterUserID"));
                 $sMasterUserIdMsg = str_replace("%f", $sMasterFilter, $sMasterUserIdMsg);
                 $this->setFailureMessage($sMasterUserIdMsg);
                 return FALSE;
             } else {
                 $rsmaster->Close();
             }
         }
     }
     // Set up foreign key field value from Session
     if ($this->getCurrentMasterTable() == "detalles") {
         $this->id_detalles->CurrentValue = $this->id_detalles->getSessionValue();
     }
     if ($this->getCurrentMasterTable() == "socios") {
         $this->id_socio->CurrentValue = $this->id_socio->getSessionValue();
     }
     // Check referential integrity for master table 'socios'
     $bValidMasterRecord = TRUE;
     $sMasterFilter = $this->SqlMasterFilter_socios();
     if (strval($this->id_socio->CurrentValue) != "") {
         $sMasterFilter = str_replace("@socio_nro@", ew_AdjustSql($this->id_socio->CurrentValue), $sMasterFilter);
     } else {
         $bValidMasterRecord = FALSE;
     }
     if ($bValidMasterRecord) {
         $rsmaster = $GLOBALS["socios"]->LoadRs($sMasterFilter);
         $bValidMasterRecord = $rsmaster && !$rsmaster->EOF;
         $rsmaster->Close();
     }
     if (!$bValidMasterRecord) {
         $sRelatedRecordMsg = str_replace("%t", "socios", $Language->Phrase("RelatedRecordRequired"));
         $this->setFailureMessage($sRelatedRecordMsg);
         return FALSE;
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // id_socio
     $this->id_socio->SetDbValueDef($rsnew, $this->id_socio->CurrentValue, NULL, FALSE);
     // id_detalles
     $this->id_detalles->SetDbValueDef($rsnew, $this->id_detalles->CurrentValue, NULL, FALSE);
     // fecha_alta
     $this->fecha_alta->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_alta->CurrentValue, 7), NULL, FALSE);
     // fecha_baja
     $this->fecha_baja->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->fecha_baja->CurrentValue, 7), NULL, FALSE);
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }
Example #21
0
 function WriteAuditTrailOnEdit(&$rsold, &$rsnew)
 {
     if (!$this->AuditTrailOnEdit) {
         return;
     }
     $table = 'socios';
     // Get key value
     $key = "";
     if ($key != "") {
         $key .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"];
     }
     $key .= $rsold['socio_nro'];
     // Write Audit Trail
     $dt = ew_StdCurrentDateTime();
     $id = ew_ScriptName();
     $usr = CurrentUserID();
     foreach (array_keys($rsnew) as $fldname) {
         if ($this->fields[$fldname]->FldDataType != EW_DATATYPE_BLOB) {
             // Ignore BLOB fields
             if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_DATE) {
                 // DateTime field
                 $modified = ew_FormatDateTime($rsold[$fldname], 0) != ew_FormatDateTime($rsnew[$fldname], 0);
             } else {
                 $modified = !ew_CompareValue($rsold[$fldname], $rsnew[$fldname]);
             }
             if ($modified) {
                 if ($this->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) {
                     // Memo field
                     if (EW_AUDIT_TRAIL_TO_DATABASE) {
                         $oldvalue = $rsold[$fldname];
                         $newvalue = $rsnew[$fldname];
                     } else {
                         $oldvalue = "[MEMO]";
                         $newvalue = "[MEMO]";
                     }
                 } elseif ($this->fields[$fldname]->FldDataType == EW_DATATYPE_XML) {
                     // XML field
                     $oldvalue = "[XML]";
                     $newvalue = "[XML]";
                 } else {
                     $oldvalue = $rsold[$fldname];
                     $newvalue = $rsnew[$fldname];
                 }
                 ew_WriteAuditTrail("log", $dt, $id, $usr, "U", $table, $fldname, $key, $oldvalue, $newvalue);
             }
         }
     }
 }
Example #22
0
 function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Set up foreign key field value from Session
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // cuit_cuil
     $this->cuit_cuil->SetDbValueDef($rsnew, $this->cuit_cuil->CurrentValue, NULL, FALSE);
     // propietario
     $this->propietario->SetDbValueDef($rsnew, $this->propietario->CurrentValue, NULL, FALSE);
     // comercio
     $this->comercio->SetDbValueDef($rsnew, $this->comercio->CurrentValue, NULL, FALSE);
     // direccion_comercio
     $this->direccion_comercio->SetDbValueDef($rsnew, $this->direccion_comercio->CurrentValue, NULL, FALSE);
     // mail
     $this->mail->SetDbValueDef($rsnew, $this->mail->CurrentValue, NULL, FALSE);
     // tel
     $this->tel->SetDbValueDef($rsnew, $this->tel->CurrentValue, NULL, FALSE);
     // cel
     $this->cel->SetDbValueDef($rsnew, $this->cel->CurrentValue, NULL, FALSE);
     // activo
     $this->activo->SetDbValueDef($rsnew, $this->activo->CurrentValue, NULL, FALSE);
     // id_usuario
     if (!$Security->IsAdmin() && $Security->IsLoggedIn()) {
         // Non system admin
         $rsnew['id_usuario'] = CurrentUserID();
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
         $this->socio_nro->setDbValue($conn->Insert_ID());
         $rsnew['socio_nro'] = $this->socio_nro->DbValue;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     return $AddRow;
 }