[Auto Solved] Custom Module

Discussion in 'Programming/Scripts' started by gody, Mar 26, 2015.

  1. gody

    gody Member

    Hi,

    I have a little probleme with a custom module.

    I try to save 3 extras informations in a new table: id, name_ext, id_ext, desc_ext + classic informations(sys_userid, sys_groupid...)

    My form, load all configured customers on ISPConfig in a select box
    When i Save
    I lost the customer information, but id_ext, name_ext, desc_ext are correctly save

    I think i miss something in Onsubmit() function, but i don't see what.

    So i need your help please
     

    Attached Files:

    Last edited: Mar 26, 2015
  2. gody

    gody Member

    Solution see => onAfterInsert

    Code:
        function onAfterInsert() {
            global $app, $conf;
    
            // make sure that the record belongs to the client group and not the admin group when a dmin inserts it
            // also make sure that the user can not delete domain created by a admin
            if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
                $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
                $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
            }
            if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
                $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
                $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id);
            }
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    This function is called on insert (creation) of the record only. If you want to store changes in your settings also when the form is edited and then saved again, then put the same code into the onAfterUpdate(...) function.
     
  4. gody

    gody Member

    Hi Till,

    Thanks for the tips!
    In isp have you function for parse json and xml ?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    No, we dont have any special functions for that. We use the normal php functions where needed.
     
  6. gody

    gody Member

    Hi,
    Perfect, :)
    THanks!
     

Share This Page