update a fileld after update_col plug in

mogy74

Member
Hi to all
I'm not a joomla/fabrik expert so i have a question for all
i have a update_col plug in working in a list , use the eval code i build a new record in a different table , it happen only when a condition is true .
this is my working code:

$db = JFactory::getDBO();
$ids = JRequest::getVar( 'ids', array(), 'method', 'array' );
foreach ($ids AS $id) {
$row = $model->getRow($id);
$mese = $row->compila_cedolino___mese;
$anno = $row->compila_cedolino___anno;
$mansione = $row->compila_cedolino___collaboratore_mansione;
$collaboratore = $row->compila_cedolino___collaboratore;
$sede = $row->compila_cedolino___sede;
$totale = $row->compila_cedolino___totale_avere;
$datafirma = $row->compila_cedolino___data_firma;
$controllo = $row->compila_cedolino___pagato;
$controllo2 = $row->compila_cedolino___controllo;
if ($controllo == SI && $controllo2 == 0){
$InsertQuery="INSERT INTO banche_out (data_operazione, movimento, descrizione_operazione, dettaglio_operazione, documento, tipo_pagamento, importo, sede, mese, anno, collaboratore, tot_uscita, pagato, data_pagamento)
VALUES ('$datafirma','Uscita','Compenso Pagato','$mansione','Cedolino','Bonifico','$totale','$sede','$mese','$anno','$collaboratore','$totale','1','$datafirma')";
$db->setQuery($InsertQuery);
$db->query();
}//important!!!! Close it
}


Now i need to add another control for prevent to write new record everytime update_col is used , i have a new field in the table the $controllo2 and it is set to 0 by default , after the plug working frist time i would update that Field in database to 1 , so the next time some one use plug in it will not write any record new ,
can i do it implementing this code? and how?

Many thanks for any help
 
I think you'd have to handle that yourself in the code. So have a second query that updates 'controllo' in the main table, then at the start of your code, test the value of $row-ompila_cedolino___controllo and don't do anything if it is set.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top