pluginasterisk.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Tomeu Borras Riera                              *
00003  *   tborras@conetxia.com                                                  *
00004  *   Copyright (C) 2006 by Fco. Javier M. C.                               *
00005  *   fcojavmc@todo-redes.com                                               *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 #include <QToolButton>
00023 
00024 #include "pluginasterisk.h"
00025 
00026 
00028 
00031 int entryPoint(Bulmafact *) {
00032     _depura("Estoy dentro del plugin de validacion con Asterisk", 0);
00033     return 0;
00034 }
00035 
00036 
00038 
00042 int TrabajadorView_TrabajadorView_Post (TrabajadorView *trab) {
00043     _depura("TrabajadorView_TrabajadorView_Post", 0);
00044 
00045     trab->addDBCampo("passasterisktrabajador", DBCampo::DBvarchar, DBCampo::DBNothing, QApplication::translate("Trabajador", "Password."));
00046 
00047 
00048     QHBoxLayout *hboxLayout160 = new QHBoxLayout();
00049     hboxLayout160->setSpacing(2);
00050     hboxLayout160->setMargin(0);
00051     hboxLayout160->setObjectName(QString::fromUtf8("hboxLayout19"));
00052 
00053     QLabel *textLabel2_9_26 = new QLabel(trab->m_frameplugin);
00054     textLabel2_9_26->setObjectName(QString::fromUtf8("textLabel2_9_9"));
00055     hboxLayout160->addWidget(textLabel2_9_26);
00056     textLabel2_9_26->setText("Password para Validacion Asterisk");
00057 
00058     QLineEdit *passtrab = new QLineEdit(trab->m_frameplugin);
00059     passtrab->setObjectName(QString::fromUtf8("mui_passasterisktrabajador"));
00060     hboxLayout160->addWidget(passtrab);
00061 
00062 
00064     QVBoxLayout *m_hboxLayout1 = trab->m_frameplugin->findChild<QVBoxLayout *>("hboxLayout1");
00065     if (!m_hboxLayout1) {
00066         m_hboxLayout1 = new QVBoxLayout(trab->m_frameplugin);
00067         m_hboxLayout1->setSpacing(0);
00068         m_hboxLayout1->setMargin(0);
00069         m_hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
00070     } // end if
00071 
00072     m_hboxLayout1->addLayout(hboxLayout160);
00073 
00074 
00076     SubForm2Bf *l = new SubForm2Bf(trab);
00077     l->setObjectName(QString::fromUtf8("m_validacionestrab"));
00078     l->setEmpresaBase( trab->empresaBase());
00079     l->setDBTableName("valasterisk");
00080     l->setDBCampoId("idvalasterisk");
00081     l->addSHeader("fechavalasterisk", DBCampo::DBdate, DBCampo::DBNotNull , SHeader::DBNone, QApplication::translate("TrabajadorView", "Fecha"));
00082     l->addSHeader("horavalasterisk", DBCampo::DBvarchar, DBCampo::DBNotNull , SHeader::DBNone, QApplication::translate("TrabajadorView", "Hora"));
00083     l->addSHeader("nomalmacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone , QApplication::translate("TrabajadorView", "Almacén"));
00084     l->addSHeader("aperturaalmacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Apertura Mañanas"));
00085     l->addSHeader("cierrealmacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Cierre Mañanas"));
00086     l->addSHeader("apertura1almacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Apertura Tardes"));
00087     l->addSHeader("cierre1almacen", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Cierre Tardes"));
00088     l->addSHeader("archvalasterisk", DBCampo::DBvarchar, DBCampo::DBNothing, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Audicion"));
00089     l->addSHeader("idalmacen", DBCampo::DBint, DBCampo::DBNotNull, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Id Almacen"));
00090     l->addSHeader("idvalasterisk", DBCampo::DBint, DBCampo::DBPrimaryKey, SHeader::DBNoView | SHeader::DBNoWrite, QApplication::translate("TrabajadorView", "ID Validacion"));
00091     l->addSHeader("idtrabajador", DBCampo::DBint, DBCampo::DBNotNull, SHeader::DBNoView | SHeader::DBNoWrite, QApplication::translate("TrabajadorView", "ID Trabajador"));
00092     l->setinsercion(TRUE);
00093     l->setDelete(TRUE);
00094     l->setSortingEnabled(FALSE);
00095     trab->dialogChanges_setQObjectExcluido(l->mui_list);
00096     trab->mui_tab->addTab(l, "Validaciones Asterisk");
00097     return 0;
00098 }
00099 
00100 
00102 
00106 int AlmacenView_AlmacenView(AlmacenView *alm) {
00107     _depura("AlmacenView_AlmacenView", 0);
00108 
00109     alm->addDBCampo("extasteriskalmacen", DBCampo::DBvarchar, DBCampo::DBNothing, QApplication::translate("Almacen", "Extension."));
00110 
00111     QHBoxLayout *hboxLayout160 = new QHBoxLayout();
00112     hboxLayout160->setSpacing(2);
00113     hboxLayout160->setMargin(0);
00114     hboxLayout160->setObjectName(QString::fromUtf8("hboxLayout19"));
00115 
00116     QLabel *textLabel2_9_26 = new QLabel(alm->mui_frameplugin);
00117     textLabel2_9_26->setObjectName(QString::fromUtf8("textLabel2_9_9"));
00118     hboxLayout160->addWidget(textLabel2_9_26);
00119     textLabel2_9_26->setText("Extensión Asterisk");
00120 
00121     QLineEdit *extalm = new QLineEdit(alm->mui_frameplugin);
00122     extalm->setObjectName(QString::fromUtf8("mui_extasteriskalmacen"));
00123     hboxLayout160->addWidget(extalm);
00124 
00126     QVBoxLayout *m_hboxLayout1 = alm->mui_frameplugin->findChild<QVBoxLayout *>("hboxLayout1");
00127     if (!m_hboxLayout1) {
00128         m_hboxLayout1 = new QVBoxLayout(alm->mui_frameplugin);
00129         m_hboxLayout1->setSpacing(0);
00130         m_hboxLayout1->setMargin(0);
00131         m_hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
00132     } // end if
00133 
00134     m_hboxLayout1->addLayout(hboxLayout160);
00135 
00136 
00138     SubForm2Bf *l = new SubForm2Bf(alm);
00139     l->setObjectName(QString::fromUtf8("m_validacionesalm"));
00140     l->setEmpresaBase( alm->empresaBase());
00141     l->setDBTableName("valasterisk");
00142     l->setDBCampoId("idvalasterisk");
00143     l->addSHeader("fechavalasterisk", DBCampo::DBdate, DBCampo::DBNotNull , SHeader::DBNone, QApplication::translate("TrabajadorView", "Fecha"));
00144     l->addSHeader("horavalasterisk", DBCampo::DBvarchar, DBCampo::DBNotNull , SHeader::DBNone, QApplication::translate("TrabajadorView", "Hora"));
00145     l->addSHeader("nomtrabajador", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNone , QApplication::translate("TrabajadorView", "Trabajador"));
00146     l->addSHeader("apellidostrabajador", DBCampo::DBvarchar, DBCampo::DBNoSave, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Apellidos"));
00147     l->addSHeader("archvalasterisk", DBCampo::DBvarchar, DBCampo::DBNothing, SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Audicion"));
00148     l->addSHeader("idalmacen", DBCampo::DBvarchar, DBCampo::DBNotNull, SHeader::DBNoView | SHeader::DBNoWrite , QApplication::translate("TrabajadorView", "Id Almacen"));
00149     l->addSHeader("idvalasterisk", DBCampo::DBint, DBCampo::DBPrimaryKey, SHeader::DBNoView | SHeader::DBNoWrite, QApplication::translate("TrabajadorView", "ID Validacion"));
00150     l->addSHeader("idtrabajador", DBCampo::DBint, DBCampo::DBNotNull, SHeader::DBNoView | SHeader::DBNoWrite, QApplication::translate("TrabajadorView", "ID Trabajador"));
00151     l->setinsercion(TRUE);
00152     l->setDelete(TRUE);
00153     l->setSortingEnabled(FALSE);
00154 
00155     alm->mui_tab->addTab(l, "Validaciones Asterisk");
00156 
00157     _depura("END AlmacenView_AlmacenView", 0);
00158     return 0;
00159 }
00160 
00161 
00163 
00167 int TrabajadorView_on_mui_guardar_clicked(TrabajadorView *trab) {
00168 
00169     QLineEdit *l = trab->findChild<QLineEdit *>("mui_passasterisktrabajador");
00170     QString query = "UPDATE trabajador SET ";
00171     query += " passasterisktrabajador = '" + l->text() + "'";
00172     query += " WHERE idtrabajador=" + trab->empresaBase()->sanearCadena(trab->idtrabajador());
00173     trab->empresaBase()->begin();
00174     trab->empresaBase()->ejecuta(query);
00175 
00176     SubForm2Bf *l1 = trab->findChild<SubForm2Bf *>("m_validacionestrab");
00177     l1->setColumnValue("idtrabajador", trab->idtrabajador());
00178     l1->guardar();
00179     trab->empresaBase()->commit();
00180     return 0;
00181 }
00182 
00183 
00185 
00189 int TrabajadorView_on_mui_lista_currentItemChanged_Post(TrabajadorView *trab) {
00190     QLineEdit *l = trab->findChild<QLineEdit *>("mui_passasterisktrabajador");
00191 
00192     cursor2 *cur = trab->empresaBase()->cargacursor("SELECT passasterisktrabajador FROM trabajador WHERE idtrabajador = " + trab->idtrabajador());
00193     if (!cur->eof()) {
00194         l->setText(cur->valor("passasterisktrabajador")); 
00195     } // end if
00196     delete cur;
00197 
00199     SubForm2Bf *l1 = trab->findChild<SubForm2Bf *>("m_validacionestrab");
00200     l1->cargar("SELECT * FROM valasterisk NATURAL LEFT JOIN almacen WHERE idtrabajador = " + trab->idtrabajador());
00201 
00202     return 0;
00203 }
00204 
00205 
00207 
00211 int Ficha_cargar(Ficha *fich) {
00212         SubForm3 *form = fich->findChild<SubForm3 *>("m_validacionesalm");
00213         if (form) 
00214              form->cargar("SELECT * FROM valasterisk NATURAL LEFT JOIN trabajador WHERE idalmacen = " + fich->DBvalue("idalmacen"));
00215         return 0;
00216 }
00217 
00218 
00219 int Ficha_guardar_Post(Ficha *fich) {
00220         SubForm3 *form = fich->findChild<SubForm3 *>("m_validacionesalm");
00221         if (form) {
00222                 form->setColumnValue("idalmacen", fich->DBvalue("idalmacen"));
00223                 form->guardar();
00224         }
00225         return 0;
00226 }
00227 
00228 

Generated on Sat Dec 15 00:01:05 2007 for BulmaGes by  doxygen 1.5.1