ispCP - Board - Support
[Add User] -- insert a control - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: General discussion (/forum-11.html)
+--- Thread: [Add User] -- insert a control (/thread-757.html)

Pages: 1 2 3 4


[Add User] -- insert a control - Ryuuku - 06-07-2007 06:57 PM

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 !


RE: [Add User] -- insert a control - Ryuuku - 06-08-2007 08:08 PM

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 !


RE: [Add User] -- insert a control - joximu - 06-08-2007 09:11 PM

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


RE: [Add User] -- insert a control - Ryuuku - 06-08-2007 10:02 PM

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 : )


RE: [Add User] -- insert a control - Ryuuku - 06-09-2007 12:36 AM

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]


RE: [Add User] -- insert a control - joximu - 06-09-2007 01:22 AM

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


RE: [Add User] -- insert a control - Ryuuku - 06-11-2007 05:56 PM

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 ; )


RE: [Add User] -- insert a control - Zothos - 06-11-2007 06:36 PM

if this sollution works as expected, maybe you can add it into the wiki? Wink


RE: [Add User] -- insert a control - Ryuuku - 06-11-2007 06:41 PM

Of course Wink ..


RE: [Add User] -- insert a control - joximu - 06-11-2007 09:22 PM

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