Current time: 04-25-2024, 08:20 AM Hello There, Guest! (LoginRegister)


Post Reply 
[Add User] -- insert a control
Author Message
Ryuuku Offline
Junior Member
*

Posts: 55
Joined: Apr 2007
Reputation: 0
Post: #1
[Add User] -- insert a control
Hi all ...
I come to search some info Big Grin

In the database / table domain ... I insert a new column named `domain_egw`
OK for this Smile
Add / Update / Delete user or hosting plans works well with this new column Wink

At the moment where a reseller add a new client (user) ... i would like to insert a control which reads if the value of `domain_egw` is set on Yes or No ... and call a script that i've done

My knowledge in prog are .... "small" ... that's why i come here to obtain advise
about the maner to insert this control Smile

Thx for your help Tongue

Ryu !
(This post was last modified: 06-08-2007 08:01 PM by Ryuuku.)
06-07-2007 06:57 PM
Find all posts by this user Quote this message in a reply
Ryuuku Offline
Junior Member
*

Posts: 55
Joined: Apr 2007
Reputation: 0
Post: #2
RE: [Add User] -- insert a control
1)
i tested to insert a control in page rau3.php ( function add_user_data )
After the 'insert into domain ' ... it seems bad plac eto insert it ...
=> Some error php with unexpected variable ..

2)
I tested to a control in page ispcp-dmn-mngr ( sub dmn_mngr_engine )
At the moment of the update of toad statuts .. . i insert this


if ($dmn_status eq 'toadd') {
$rs = dmn_add_data($entry);
$timestamp = time();

if ($rs == 0) {
$sql = "update domain set domain_status='ok' where domain_id = $dmn_id";
my $egw_ctrl = "select domain_egw from domain where domain_name = $dmn_name;";
if ( $egw_ctrl = 'yes' ) {
mkdir ("egw_ctrl1",0777) ;
} else {
mkdir ("egw_ctrl2",0777) ;
}


} else {
my ($sub_name, $msg) = split(/$main::el_sep/, pop_el(\@main::el));
$msg =~ s/\'/\\\'/g;
$sql = "update domain set domain_status='$sub_name | $msg' where domain_id = $dmn_id;";
}


=> no error when the user is inserted ... but the status of the new user stay to 'Toadd' Big Grin no change on "ok"

Smile Somebody see an error ?

Ryu !
(This post was last modified: 06-08-2007 08:12 PM by Ryuuku.)
06-08-2007 08:08 PM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #3
RE: [Add User] -- insert a control
You need to execute the SQL commands (at least your egw_ctrl - sql commands)
see some line below:
($rs, $rdata) = doSQL($sql);

but I don't know why your version does not reset the status to "ok"...

I'd do it maybe like this:
Code:
... line 3883... (version from may 29)
    if ($dmn_status eq 'toadd') {

        $rs = dmn_add_data($entry);

        $timestamp = time();

        if ($rs == 0 && set_dmn_egw($dmn_id)) {

            $sql = "update domain set domain_status='ok' where domain_id = $dmn_id";

        } else {

            my ($sub_name, $msg) = split(/$main::el_sep/, pop_el(\@main::el));

            $msg =~ s/\'/\\\'/g;

            $sql = "update domain set domain_status='$sub_name | $msg' where domain_id = $dmn_id;";

        }

        ($rs, $rdata) = doSQL($sql);

        return $rs if ($rs != 0);
...

and then create your own function (set_dmn_egw) which do the egw-thing...
Your function should be executed if ($rs == 0) and if your function does ends with a "true" then the status should be set to 'ok' - else you can setup a msg...

Hope you can manage this...

/Joximu
06-08-2007 09:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Ryuuku Offline
Junior Member
*

Posts: 55
Joined: Apr 2007
Reputation: 0
Post: #4
RE: [Add User] -- insert a control
First ; ) Thx for your answer .. Smile

I'm going to try to understand all you said Tongue ... and follow your advise Smile

I'm going to test Smile

Thx again Joximu : )
06-08-2007 10:02 PM
Find all posts by this user Quote this message in a reply
Ryuuku Offline
Junior Member
*

Posts: 55
Joined: Apr 2007
Reputation: 0
Post: #5
RE: [Add User] -- insert a control
So results of my test Smile
Following your advises , i create this function >>>

Code:
## Domain Egroupware Manager

sub set_egw_dmn {

my ($rs, $rdata) = ('', '');
my ($dmn_data) = @_;
my $dmn_name = @$dmn_data[1];

my $sql = "select domain_egw from domain where domain_name = $dmn_name";

($rs, $rdata) = doSQL($sql);

if ($sql eq 'yes') {
        mkdir ('egw_ctrl1',0777) ;
} elsif ($sql eq 'no') {
        mkdir ('egw_ctrl2',0777) ;
}

} # Fin Fonction set_egw_dmn


mkdir are just commands to see if function is well executed
..
When i add a new user :
-> The insert is well done in database ... Wink
-> Dir ( egw_ctrl1 or egw_ctrl2 ) isn't created Tongue
-> Status still stay on 'toadd' :X ... Big Grin
-> Delete this new user is well done Smile

So i have to fix this Tongue Wink [/code]
(This post was last modified: 06-09-2007 12:39 AM by Ryuuku.)
06-09-2007 12:36 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #6
RE: [Add User] -- insert a control
Well - now debugging is your friend.

Is the domain created normally (the folders - except the egw...)?

It seems that the perl script isn't running or is not coming to the part where you changed things...

I think you can run the perl file manually...
ispcp-dmn-mngr domain_id

/J
06-09-2007 01:22 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Ryuuku Offline
Junior Member
*

Posts: 55
Joined: Apr 2007
Reputation: 0
Post: #7
RE: [Add User] -- insert a control
Enjoy the debug Tongue Big Grin

... Yeah .. the domain ( new user ) is well created ...
=> Data ok in database
=> Files & Dirs .. /var/www/fcgi/new_user OK ---- /var/www/virtual/new_user OK
=> Section in site-available/ispcp.conf is also OK Smile

all is ok except things i had ... ^ ^ Smile

Command ispcp-dmn-mngr new_user_id don't give errors : )

Go GO to debug Ryu ^

See you soon Tongue

Thx /J ; )
06-11-2007 05:56 PM
Find all posts by this user Quote this message in a reply
Zothos Offline
Release Manager
*****
Dev Team

Posts: 1,262
Joined: Feb 2007
Reputation: 10
Post: #8
RE: [Add User] -- insert a control
if this sollution works as expected, maybe you can add it into the wiki? Wink
06-11-2007 06:36 PM
Find all posts by this user Quote this message in a reply
Ryuuku Offline
Junior Member
*

Posts: 55
Joined: Apr 2007
Reputation: 0
Post: #9
RE: [Add User] -- insert a control
Of course Wink ..
06-11-2007 06:41 PM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #10
RE: [Add User] -- insert a control
Hi Ryuuku

just realized: you added a field to table "domain" didn't you?

Have a look at http://www.isp-control.net/ispcp/ticket/387 and the linkt to another thread here in the forum....
It's not yet possible to add fields to some of the tables because of... see ticket...

Maybe this is the thing which also blocks your system...

/J
06-11-2007 09:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)