noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 01/06: A l'installation permet de choisir le


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 01/06: A l'installation permet de choisir le nom de l'administrateur, dans les versions précédentes c'était phpcompta
Date: Tue, 02 Feb 2016 14:39:20 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 30f84ace56efe79555bdeee124a0ea172f83c8a5
Author: Dany De Bontridder <address@hidden>
Date:   Sat Jan 30 22:32:56 2016 +0100

    A l'installation permet de choisir le nom de l'administrateur, dans
    les versions précédentes c'était phpcompta
---
 html/install.php                          |   30 ++++++++++++++-
 include/class/class_acc_ledger.php        |    4 +-
 include/class/class_acc_operation.php     |    2 +-
 include/class/class_dossier.php           |    4 +-
 include/class/class_user.php              |    2 +-
 include/constant.php                      |    4 ++
 include/lib/config_file.php               |   58 +++++++++++++++-------------
 include/template/template_config_form.php |    8 ++++
 8 files changed, 78 insertions(+), 34 deletions(-)

diff --git a/html/install.php b/html/install.php
index 3842586..166cbd3 100644
--- a/html/install.php
+++ b/html/install.php
@@ -216,6 +216,8 @@ $locale=HtmlInput::default_value_request("clocale", "1");
 $ctmp=HtmlInput::default_value_request("ctmp", "/tmp");
 $cpath=HtmlInput::default_value_request("cpath", "/usr/bin");
 $db_name=HtmlInput::default_value_request("cdbname", "");
+$cadmin=HtmlInput::default_value_request("cadmin", "phpcompta");
+$cadmin=strtolower($cadmin);
 //-------------------------------------------------------------------------
 // warn only if we can not write in include 
 //-------------------------------------------------------------------------
@@ -244,6 +246,9 @@ if (isset($_POST['save_config'])) {
   // If conx successfull save the file or display it
   // -----
   if ( $cnx !== false ) {
+       echo '<h1>'._('Important').'</h1>';
+       echo '<p>'._('Utilisateur administrateur'),' ',$cadmin,'</p>';
+       echo '<p>',_('Mot de passe'),' phpcompta','</p>';
       // Create the db
       if (is_writable(NOALYSS_INCLUDE)) { 
         $url=config_file_create($_POST,1,$os); 
@@ -265,6 +270,7 @@ if (isset($_POST['save_config'])) {
           print (_('Puis cliquez sur ce lien'))." ";
           echo '<a 
href="install.php?lang='.$_GET['lang'].'">'._('Installation')."</a>";
           echo '</p>';
+      
           echo '<textarea cols="80" rows="50" style="height:auto">';
           echo display_file_config($_POST,1,$os);
           echo '</textarea>';
@@ -551,6 +557,11 @@ if ($account == 0 ) {
   $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/schema.sql");
   $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/data.sql");
   
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql");
+  /* update name administrator */
+  $cadmin=NOALYSS_ADMINISTRATOR;
+  $cn->exec_sql("update ac_users set use_login=$1 where use_id=1",
+              array(strtolower($cadmin)));
+
   $cn->commit($cn);
 
  if ( ! DEBUG) ob_end_clean();
@@ -579,7 +590,9 @@ if ($account == 0 ) {
   $cn->commit();
 
  if ( ! DEBUG) ob_end_clean();
-
+echo '<h1>'._('Important').'</h1>';
+echo '<p>'._('Utilisateur  administrateur'),' ',$cadmin,'</p>';
+echo '<p>',_('Mot de passe'),' phpcompta','</p>';
  }// end if
 // Add a french accountancy model
 //--
@@ -597,8 +610,15 @@ if  (defined("MULTI") && MULTI == 0)
        {
             if ( ! DEBUG) { ob_start();  }
             $db->execute_script(NOALYSS_INCLUDE.'/sql/mono/mono.sql');
+                     
             if ( ! DEBUG) ob_end_clean();
        }
+        /* update name administrator */
+        if ( isset ($_REQUEST['cadmin'])) {
+           $db->exec_sql("update ac_users set use_login=$1 where use_id=1",
+            array($cadmin));
+        }
+        
         if ($db->exist_table("version") == false)
        {
                echo '<p class="warning">' . $failed ;
@@ -627,6 +647,9 @@ if  (defined("MULTI") && MULTI == 0)
                 
$db->execute_script(NOALYSS_INCLUDE.'/sql/patch/ac-upgrade'.$i.'.sql');
             }
         }
+        echo '<h1>'._('Important').'</h1>';
+        echo '<p>'._('Utilisateur administrateur'),' ',$cadmin,'</p>';
+        echo '<p>',_('Mot de passe'),' phpcompta','</p>';
         echo "<h2 class=\"warning\">";
         printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__);
         echo "</h2>";
@@ -644,7 +667,12 @@ if  (defined("MULTI") && MULTI == 0)
 define ('ALLOWED',1);
 $_GET['sb']="upg_all";
 $rep=new Database();
+$rep->exec_sql("update ac_users set use_login=$1 where use_id=1",
+              array(strtolower(NOALYSS_ADMINISTRATOR)));
 require NOALYSS_INCLUDE."/upgrade.inc.php";
+echo '<h1>'._('Important').'</h1>';
+echo '<p>'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'</p>';
+        
 echo "<h2 class=\"warning\">";
 printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__);
 echo "</h2>";
diff --git a/include/class/class_acc_ledger.php 
b/include/class/class_acc_ledger.php
index 45013b5..73124d1 100644
--- a/include/class/class_acc_ledger.php
+++ b/include/class/class_acc_ledger.php
@@ -3245,7 +3245,7 @@ class Acc_Ledger extends jrn_def_sql
                        echo Acc_Reconciliation::$javascript;
                        html_page_start();
                        $cn = Dossier::connect();
-                       $_SESSION['g_user'] = 'phpcompta';
+                       $_SESSION['g_user'] = NOALYSS_ADMINISTRATOR ;
                        $_SESSION['g_pass'] = 'phpcompta';
 
                        $id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] 
: -1;
@@ -3335,7 +3335,7 @@ class Acc_Ledger extends jrn_def_sql
                        html_page_start();
                        $cn = Dossier::connect();
                        $ledger = new Acc_Ledger($cn, 0);
-                       $_SESSION['g_user'] = 'phpcompta';
+                       $_SESSION['g_user'] = NOALYSS_ADMINISTRATOR;
                        $_SESSION['g_pass'] = 'phpcompta';
                        echo $ledger->search_form('ALL');
                }
diff --git a/include/class/class_acc_operation.php 
b/include/class/class_acc_operation.php
index bd2d711..a064ab1 100644
--- a/include/class/class_acc_operation.php
+++ b/include/class/class_acc_operation.php
@@ -576,7 +576,7 @@ class Acc_Operation
     }
     static function test_me()
     {
-        $_SESSION['g_user']='phpcompta';
+        $_SESSION['g_user']=NOALYSS_ADMINISTRATOR;
         $_SESSION['g_pass']='dany';
         global $g_user;
         $cn=Dossier::connect();
diff --git a/include/class/class_dossier.php b/include/class/class_dossier.php
index 132bd16..9d6944d 100644
--- a/include/class/class_dossier.php
+++ b/include/class/class_dossier.php
@@ -151,11 +151,11 @@ class Dossier
                     join  jnt_use_dos as jt on (jt.dos_id=ds.dos_id)
                     group by jt.use_id) as dossier_name on 
(jt_use_id=ac.use_id)
             where
-            use_login!='phpcompta'
+            use_login!=$1
             $sql
             ";
 
-        $res=$this->cn->get_array($sql);
+        $res=$this->cn->get_array($sql,array(NOALYSS_ADMINISTRATOR));
         return $res;
     }
 
diff --git a/include/class/class_user.php b/include/class/class_user.php
index 124628d..ee3b446 100644
--- a/include/class/class_user.php
+++ b/include/class/class_user.php
@@ -384,7 +384,7 @@ class User
        function Admin()
        {
             $this->admin = 0;
-               if ($this->login != 'phpcompta')
+               if ($this->login != NOALYSS_ADMINISTRATOR )
                {
                        $pass5 = md5($this->pass);
                        $sql = "select use_admin from ac_users where 
use_login=$1
diff --git a/include/constant.php b/include/constant.php
index 655e629..2d98688 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -47,6 +47,10 @@ if ( !defined("NOALYSS_TEMPLATE")) define 
("NOALYSS_TEMPLATE",$g_template_dir);
 // with convert
 if ( !defined("FIX_BROKEN_PDF")) define ("FIX_BROKEN_PDF",'NO');
 
+if ( !defined('NOALYSS_ADMINISTRATOR')) {
+    define ('NOALYSS_ADMINISTRATOR','phpcompta');
+}
+
 require_once NOALYSS_INCLUDE.'/constant.security.php';
 
 if ( strpos($inc_path,";") != 0 ) {
diff --git a/include/lib/config_file.php b/include/lib/config_file.php
index f24379d..977d140 100644
--- a/include/lib/config_file.php
+++ b/include/lib/config_file.php
@@ -69,6 +69,7 @@ function config_file_form($p_array=null)
        $multi="N";
        $cdbname="";
         $chost="localhost";
+        $cadmin='admin';
 
     }
     else extract ($p_array);
@@ -77,32 +78,34 @@ function config_file_form($p_array=null)
     $ictmp->size=25;
 
     $iclocale=new ISelect('clocale');
-       $iclocale->value=array(
-               array("value"=>1,"label"=>"Activé"),
-               array("value"=>0,"label"=>"Désactivé")
-       );
-       $iclocale->selected=1;
+    $iclocale->value=array(
+            array("value"=>1,"label"=>"Activé"),
+            array("value"=>0,"label"=>"Désactivé")
+    );
+    $iclocale->selected=1;
 
-       $icpath=new IText("cpath",$cpath);
-       $icpath->size=30;
+    $icpath=new IText("cpath",$cpath);
+    $icpath->size=30;
+    
+    $icuser=new IText('cuser',$cuser);
+    $icpasswd=new IText('cpasswd',$cpasswd);
+    $icport=new IText("cport",$cport);
+    $ichost=new IText("chost",$chost);
+    
+    $icadmin=new IText('cadmin',$cadmin);
+    /*
+     * For version MONO
+     */
+    $smulti=new ICheckBox('multi');
+    $smulti->javascript=' onchange="show_dbname(this)" ';
+    $smulti->value = 'Y';
+    if ( $multi == 'Y') {
+        $smulti->selected=true;
 
-       $icuser=new IText('cuser',$cuser);
-       $icpasswd=new IText('cpasswd',$cpasswd);
-       $icport=new IText("cport",$cport);
-       $ichost=new IText("chost",$chost);
-       /*
-        * For version MONO
-        */
-       $smulti=new ICheckBox('multi');
-       $smulti->javascript=' onchange="show_dbname(this)" ';
-        $smulti->value = 'Y';
-        if ( $multi == 'Y') {
-            $smulti->selected=true;
-            
-        }
-       $icdbname=new IText('cdbname');
-        $icdbname->value=$cdbname;
-       require NOALYSS_TEMPLATE.'/template_config_form.php';
+    }
+    $icdbname=new IText('cdbname');
+    $icdbname->value=$cdbname;
+    require NOALYSS_TEMPLATE.'/template_config_form.php';
 }
 /**
  * Display the  content of the config.inc.php with variables
@@ -146,7 +149,9 @@ function display_file_config($p_array,$from_setup=1,$p_os=1)
     print ("\r\n");
     print ( 'define ("noalyss_psql_host","'.$chost.'");');
     print ("\r\n");
-
+    print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");');
+    print ("\r\n");
+    
     print ( 'define ("LOCALE",'.$clocale.');');
     print ("\r\n");
 
@@ -187,12 +192,11 @@ function 
display_file_config($p_array,$from_setup=1,$p_os=1)
     print ( '// define ("NOALYSS_INCLUDE","");');
     print ("\r\n");
     print ( '// define ("NOALYSS_TEMPLATE","");');
+    print ("\r\n");
     print ( "// Fix an issue with PDF when exporting receipt in PDF in 
ANCGL"."\r\n");
     print ( '// define ("FIX_BROKEN_PDF","NO");');
     print ("\r\n");
     print ("\r\n");
-    print ("\r\n");
-    print ("\r\n");
     print ( "// Uncomment if you don't want "."\r\n");
     print ( "// to be informed when a new release is "."\r\n");
     print ( "// published"."\r\n");
diff --git a/include/template/template_config_form.php 
b/include/template/template_config_form.php
index 3df7154..fae5e8a 100644
--- a/include/template/template_config_form.php
+++ b/include/template/template_config_form.php
@@ -51,6 +51,14 @@
                <TD><?php echo _('Mot de passe de l\'utilisateur 
Postgresql');?> </TD>
                <TD><?php echo $icpasswd->input();echo 
HtmlInput::infobulle(204)?></TD>
 </TR>
+<tr>
+    <td>
+        <?php echo _('Administrateur de noalyss')?>
+    </td>
+    <td>
+        <?php echo $icadmin->input();?>
+    </td>
+</tr>
 <TR>
        <TD><?php echo _('Adresse Serveur Postgresql');?> </TD>
        <TD><?php echo $ichost->input();echo HtmlInput::infobulle(208)?></TD>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]