Exemple #1
0
         } else {
             $fev = 28;
         }
         $Res = $cn->exec_sql("delete from user_local_pref where parameter_type='PERIODE'");
         $nb_day = array(31, $fev, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
         $m = 1;
         foreach ($nb_day as $day) {
             $p_start = sprintf("01-%d-%s", $m, $year);
             $p_end = sprintf("%d-%d-%s", $day, $m, $year);
             $sql = sprintf("insert into parm_periode (p_start,p_end,p_exercice)\n                                 values (to_date('%s','DD-MM-YYYY'),to_date('%s','DD-MM-YYYY'),'%s')", $p_start, $p_end, $year);
             $Res = $cn->exec_sql($sql);
             $m++;
         }
         $sql = "\tinsert into jrn_periode(p_id,jrn_def_id,status) " . "select p_id,jrn_def_id, 'OP'" . " from parm_periode cross join jrn_def";
         $Res = $cn->exec_sql($sql);
         Dossier::synchro_admin($l_id);
     }
 } else {
     /*
      * An empty database is asked, it is created 
      */
     $Sql = sprintf("CREATE DATABASE %sDOSSIER%d encoding='UTF8' ", domaine, $l_id, domaine);
     ob_start();
     if ($repo->exec_sql($Sql) == false) {
         echo "[" . $Sql . "]";
         //ob_end_clean();
         $repo->exec_sql("delete from ac_dossier where dos_id={$l_id}");
         echo _("Echec création ");
         exit;
     }
     ob_flush();
Exemple #2
0
/*
 * If multi folders
 */
$Resdossier = $cn->exec_sql("select dos_id, dos_name from ac_dossier");
$MaxDossier = $cn->size($Resdossier);
//----------------------------------------------------------------------
// Upgrade the folders
//----------------------------------------------------------------------
for ($e = 0; $e < $MaxDossier; $e++) {
    $db_row = Database::fetch_array($Resdossier, $e);
    echo "<h3>Patching " . $db_row['dos_name'] . '</h3>';
    $name = $cn->format_name($db_row['dos_id'], 'dos');
    if ($cn->exist_database($name) > 0) {
        $db = new Database($db_row['dos_id'], 'dos');
        $db->apply_patch($db_row['dos_name']);
        Dossier::synchro_admin($db_row['dos_id']);
    } else {
        echo_warning(_("Dossier inexistant") . " {$name}");
    }
}
//----------------------------------------------------------------------
// Upgrade the template
//----------------------------------------------------------------------
$Resdossier = $cn->exec_sql("select mod_id, mod_name from modeledef");
$MaxDossier = $cn->size();
echo "<h2>Mise &agrave; jour mod&egrave;le</h2>";
for ($e = 0; $e < $MaxDossier; $e++) {
    $db_row = Database::fetch_array($Resdossier, $e);
    echo "<h3>Patching " . $db_row['mod_name'] . "</h3>";
    $name = $cn->format_name($db_row['mod_id'], 'mod');
    if ($cn->exist_database($name) > 0) {