Closed dvdcut closed 4 years ago
Hi,
I can't see any code for updating the record if in edit mode, I guess it would need a test of if ($id==0) then INSERT else UPDATE
dont know if this ever worked since edit/add was merged.
you're probably right
that is serious bug, if some one is trying to install this it is not going to work for end user. but adding zone always worked even after add/edit merge.
to be clear -
Is that the correct interpretation ?
@twa127 did you test #311 or it was working before?
@twa127 for me, this morning, when i add zone, it wouldn't add record to message_out table at all, now after #311 it add record to message_out table and when i edit zone record it does not edit exiting record from message_out table but add another one.
I think #311 fixes the issue of creating duplicate records in the messages_out table be changing the test for no record from if ($result) { to if (mysqli_num_rows($result) ==0){
I think when editing we need to capture the 'id' of the messages_out record linked to the zone and then update it on save, the INSERT statement is only required when adding a new zone
editing issue is still there, query to search for exiting record is all wrong, it is searing for already submitted record in message_out
$query = "SELECT * FROM messages_out WHERE node_id = '{$controler}' AND child_id = '{$controler_child_id}' AND zone_id = '{$zone_id}' LIMIT 1;";
as I read it that query can be used to get the 'id' of the existing messages_out recort which must exist if we are editing and can be used for an update query, will not be needed if in add zone mode where we must insert a new messages_out record
the select query would need to be moved to the section where we load the data if in edit mode
I'm happy to provide an update if required :-)
@twa127 that would be wonderful if you can do it
okay, let you know
committed a fix - checks if in add or edit mode, if add then insert new message_out, if edit then capture the id of the existing message_out in a hidden input field and use this to update the existing message_out
tidied up the record INSERT/UPDATE success fail messages
@twa127 thank you for fixing this.
@twa127 zone.php have error on line 104
$query = "INSERT INTO
messages_out(
sync,
purge,
node_id,
child_id,
sub_type,
ack,
type,
payload,
sent,
datetime,
zone_id) VALUES ('0', '0',$
when adding zone it wouldn't add message_out record. i think this is the fix for adding record but when i modify it add another one rather then editing exiting record for same zone.