EOF;
diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php
index 81ffc5878..786c12914 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -105,7 +105,8 @@ class Acc_Ledger_Search
*/
function search_form()
{
- global $g_user;
+ global $g_user,$g_parameter;
+ $g_parameter=new Noalyss_Parameter_Folder($this->cn);
$http=new HttpInput();
$r="";
$bledger_param=json_encode(array(
diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php
index f7442efce..46c53e615 100644
--- a/include/class/dossier.class.php
+++ b/include/class/dossier.class.php
@@ -50,11 +50,10 @@ class Dossier
$this->dos_id=$p_id;
}
- /*!\brief return the $_REQUEST['gDossier'] after a check */
+ /*!\brief return the 'gDossier' value after a check */
static function id()
{
- self::check();
$http=new HttpInput();
return $http->request('gDossier','number');
@@ -127,11 +126,12 @@ class Dossier
return $nb_folder;
}
- /*!
- * \brief Return all the users
- * as an array
+ /**
+ * \brief Return all the users as an array but NOALYSS_ADMINISTRATOR, that user cannot be changed by the
+ * interface for administrating user
+ * \param SQL $sql sql string to add to the query :
+ * \note that string MUST be the result of Database::escape_string
*/
-
function get_user_folder($sql="")
{
@@ -162,20 +162,21 @@ class Dossier
return $res;
}
- /*!\brief check if gDossier is set */
+ /*!\brief check if gDossier is set
+ * ?? dead code ???
+ */
static function check()
{
- if (!isset($_REQUEST['gDossier']))
- {
- echo_error('Dossier inconnu ');
- exit('Dossier invalide ');
+ try {
+ $http=new HttpInput();
+ $id=$http->request("gDossier","number");
+ if ($id > 999999 || $id < 0) throw new \Exception(_("Dossier max dépassé "));
+ } catch (\Exception $e) {
+
+ die('Dossier invalide ');
}
- $id=$_REQUEST['gDossier'];
- if (is_numeric($id)==0||
- strlen($id)>6||
- $id>999999)
- exit('gDossier Invalide : '.$id);
+
}
/*!
@@ -184,27 +185,30 @@ class Dossier
static function get()
{
- self::check();
- return "gDossier=".$_REQUEST['gDossier'];
+ $http=new \HttpInput();
+ return "gDossier=".$http->request("gDossier","number");
}
- /*!\brief return a string to set gDossier into a FORM */
+ /*!
+ * \brief return a string to set gDossier into a FORM
+ */
static function hidden()
{
- self::check();
- return '';
+ $http=new \HttpInput();
+
+ return '';
}
/*!\brief retrieve the name of the current dossier */
static function name($id=0)
{
- self::check();
+ $http=new \HttpInput();
$cn=new Database();
- $id=($id==0)?$_REQUEST['gDossier']:$id;
- $name=$cn->get_value("select dos_name from ac_dossier where dos_id=$1", array($_REQUEST['gDossier']));
+ $id=($id==0)?$http->request("gDossier","number"):$id;
+ $name=$cn->get_value("select dos_name from ac_dossier where dos_id=$1", array($id));
return $name;
}
@@ -419,9 +423,9 @@ class Dossier
*/
static function set_current($p_dossier) {
+ self::check($p_dossier);
put_global([ [ "key"=>"gDossier","value"=>$p_dossier]]);
- self::check();
-
+
}
}
diff --git a/include/class/extension.class.php b/include/class/extension.class.php
index 988f6702d..bf60cbdad 100644
--- a/include/class/extension.class.php
+++ b/include/class/extension.class.php
@@ -148,6 +148,7 @@ class Extension extends Menu_Ref_sql
throw new Exception(_('Profil inexistant'), 10);
}
// Menu exists
+ \Noalyss\Dbg::echo_var(1,__FILE__.__LINE__. "p_module to find $p_module");
$module=new Menu_Ref($cn, $p_module);
if ($module->me_code==null)
{
diff --git a/include/class/noalyss_user.class.php b/include/class/noalyss_user.class.php
index e248317b4..ae7a0f560 100644
--- a/include/class/noalyss_user.class.php
+++ b/include/class/noalyss_user.class.php
@@ -1636,11 +1636,12 @@ class Noalyss_User
* @brief Save the password of the current user
* @param string $p_pass1 password (clear)
* @param string $p_pass2 for confirming password (clear)
+ * @see check_password_strength()
* @return true : password successfully changed otherwise false
*/
function save_password($p_pass1, $p_pass2)
{
- if ($p_pass1==$p_pass2)
+ if ($p_pass1==$p_pass2 && count(check_password_strength($p_pass1)['msg'])==0)
{
$repo=new Database();
$l_pass=md5($p_pass1);
diff --git a/include/class/pdf.class.php b/include/class/pdf.class.php
index 167175598..3cc88e39a 100644
--- a/include/class/pdf.class.php
+++ b/include/class/pdf.class.php
@@ -72,7 +72,7 @@ class PDF extends PDF_Core
parent::Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
parent::Ln(3);
// Created by NOALYSS
- parent::Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+ parent::Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'C',false,'https://www.noalyss.eu');
}
/**
*@brief retrieve the client name and quick_code
diff --git a/include/class/pdf_land.class.php b/include/class/pdf_land.class.php
index 3cb5d0863..d807330c3 100644
--- a/include/class/pdf_land.class.php
+++ b/include/class/pdf_land.class.php
@@ -71,7 +71,7 @@ class PDFLand extends PDF
$this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
$this->Ln(3);
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+ $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'C',false,'https://www.noalyss.eu');
}
}
\ No newline at end of file
diff --git a/include/class/periode.class.php b/include/class/periode.class.php
index d15eb1e43..63ac4de06 100644
--- a/include/class/periode.class.php
+++ b/include/class/periode.class.php
@@ -54,11 +54,11 @@ class Periode
{
$r=<<$jrn_def_id,
- \$p_id=>$p_id,
- \$status => $status,
- \$p_start => $p_start,
- \$p_end => $p_end,
+ \$jrn_def_id=>$this->jrn_def_id,
+ \$p_id=>$this->p_id,
+ \$status => $this->status,
+ \$p_start => $this->p_start,
+ \$p_end => $this->p_end,
]
EOF;
return $r;
diff --git a/include/class/print_ledger_detail.class.php b/include/class/print_ledger_detail.class.php
index 9d6a62126..87bed1772 100644
--- a/include/class/print_ledger_detail.class.php
+++ b/include/class/print_ledger_detail.class.php
@@ -64,7 +64,7 @@ class Print_Ledger_Detail extends Print_Ledger
//Page number
$this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'R',false,'http://www.noalyss.eu');
+ $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
}
diff --git a/include/class/print_ledger_detail_item.class.php b/include/class/print_ledger_detail_item.class.php
index a29507128..84399c08c 100644
--- a/include/class/print_ledger_detail_item.class.php
+++ b/include/class/print_ledger_detail_item.class.php
@@ -75,7 +75,7 @@ class Print_Ledger_Detail_Item extends Print_Ledger
//Page number
$this->Cell(30,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'R',false,'http://www.noalyss.eu');
+ $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
}
diff --git a/include/class/print_ledger_fin.class.php b/include/class/print_ledger_fin.class.php
index cf4827b16..7352df6dc 100644
--- a/include/class/print_ledger_fin.class.php
+++ b/include/class/print_ledger_fin.class.php
@@ -89,7 +89,7 @@ class Print_Ledger_Financial extends Print_Ledger
$this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
$this->Ln(3);
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+ $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'C',false,'https://www.noalyss.eu');
}
/**
diff --git a/include/class/print_ledger_misc.class.php b/include/class/print_ledger_misc.class.php
index 77a7774cb..1cdf29456 100644
--- a/include/class/print_ledger_misc.class.php
+++ b/include/class/print_ledger_misc.class.php
@@ -62,7 +62,7 @@ class Print_Ledger_Misc extends Print_Ledger
$this->Cell(0,6,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
$this->Ln(3);
// Created by NOALYSS
- $this->Cell(0,6,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+ $this->Cell(0,6,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'C',false,'https://www.noalyss.eu');
}
/**
*@brief print the pdf
diff --git a/include/class/print_ledger_simple.class.php b/include/class/print_ledger_simple.class.php
index 05ec0f7e6..5ac660b18 100644
--- a/include/class/print_ledger_simple.class.php
+++ b/include/class/print_ledger_simple.class.php
@@ -243,7 +243,7 @@ class Print_Ledger_Simple extends \Print_Ledger
//Page number
$this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'R',false,'http://www.noalyss.eu');
+ $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
}
diff --git a/include/class/print_ledger_simple_without_vat.class.php b/include/class/print_ledger_simple_without_vat.class.php
index d2b9668d3..844101732 100644
--- a/include/class/print_ledger_simple_without_vat.class.php
+++ b/include/class/print_ledger_simple_without_vat.class.php
@@ -135,7 +135,7 @@ class Print_Ledger_Simple_Without_Vat extends Print_Ledger
//Page number
$this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
// Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'R',false,'http://www.noalyss.eu');
+ $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
}
/**
diff --git a/include/constant.php b/include/constant.php
index 6e2607785..b939750d7 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -106,9 +106,9 @@ $version_noalyss = SVNINFO;
// If you don't want to be notified of the update
if (!defined("SITE_UPDATE"))
- define("SITE_UPDATE", 'http://www.noalyss.eu/last_version.txt');
+ define("SITE_UPDATE", 'https://www.noalyss.eu/last_version.txt');
if (!defined("SITE_UPDATE_PLUGIN"))
- define("SITE_UPDATE_PLUGIN", 'http://www.noalyss.eu/plugin_last_version.txt');
+ define("SITE_UPDATE_PLUGIN", 'https://www.noalyss.eu/plugin_last_version.txt');
if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
define("NOALYSS_PACKAGE_REPOSITORY", "https://package.noalyss.eu/");
}
@@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
if (!defined("SYSINFO_DISPLAY")) {
define("SYSINFO_DISPLAY", TRUE);
}
-define("DBVERSION", 189);
+define("DBVERSION", 190);
define("MONO_DATABASE", 25);
define("DBVERSIONREPO", 20);
define('NOTFOUND', '--not found--');
diff --git a/include/export/export_fiche_balance_pdf.php b/include/export/export_fiche_balance_pdf.php
index 0a0031527..8db11a6a3 100644
--- a/include/export/export_fiche_balance_pdf.php
+++ b/include/export/export_fiche_balance_pdf.php
@@ -32,10 +32,16 @@ $gDossier=dossier::id();
$cn=Dossier::connect();
$g_user->Check();
$g_user->check_dossier($gDossier);
-$name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',array($_GET['cat']));
+
+$http=new HttpInput();
+
+$cat = $http->get("cat");
+$histo = $http->get("histo");
+
+$name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',array($cat));
$pdf=new PDF($cn);
-$pdf->setDossierInfo(" Periode : ".$_GET['start']." - ".$_GET['end']);
+$pdf->setDossierInfo(" Periode : ".$http->get('start')." - ".$http->get('end'));
$pdf->AliasNbPages();
$pdf->AddPage();
@@ -46,9 +52,9 @@ $allcard=(isset($_GET['allcard']))?1:0;
/*
* Balance
*/
-if ( $_GET['histo'] == 4 || $_GET['histo']==5)
+if ($histo == 4 || $histo==5)
{
- $fd=new Fiche_Def($cn,$_REQUEST['cat']);
+ $fd=new Fiche_Def($cn,$http->request('cat'));
if ($allcard==1 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false )
{
$pdf->write_cell(0,10, "Cette catégorie n'ayant pas de poste comptable n'a pas de balance");
@@ -64,7 +70,7 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
}
else
{
- $afiche[0]=array('fd_id'=>$_REQUEST['cat']);
+ $afiche[0]=array('fd_id'=>$http->request('cat'));
}
if ( $allcard==0 && empty($afiche))
@@ -96,26 +102,16 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
$idx=0;$sum_deb=0;$sum_cred=0;bcscale(4);
for ($i=0;$i < count($aCard);$i++)
{
- if ( isDate($_REQUEST['start']) == null || isDate ($_REQUEST['end']) == null ) exit;
- $filter= " (j_date >= to_date('".$_REQUEST['start']."','DD.MM.YYYY') ".
- " and j_date <= to_date('".$_REQUEST['end']."','DD.MM.YYYY')) ";
+ if ( isDate($http->request('start')) == null || isDate ($http->request('end')) == null ) exit;
+ $filter= " (j_date >= to_date('".$http->request('start')."','DD.MM.YYYY') ".
+ " and j_date <= to_date('".$http->request('end')."','DD.MM.YYYY')) ";
$oCard=new Fiche($cn,$aCard[$i]['f_id']);
$solde=$oCard->get_solde_detail($filter);
if ( $solde['debit'] == 0 && $solde['credit']==0) continue;
/* only not purged card */
- if ($_GET['histo'] == 5 && $solde['debit'] == $solde['credit']) continue;
-
- if ( $idx % 2 == 0 )
- {
- $pdf->SetFillColor(220,221,255);
- $fill=1;
- }
- else
- {
- $pdf->SetFillColor(0,0,0);
- $fill=0;
- }
- $idx++;
+ if ($histo == 5 && $solde['debit'] == $solde['credit']) continue;
+ $fill=$pdf->is_fill($idx);
+ $idx++;
$side='';
if(bcsub($solde['credit'],$solde['debit']) < 0) $side='Deb.';
if(bcsub($solde['credit'],$solde['debit']) > 0) $side='Cred.';
@@ -132,16 +128,8 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5)
$pdf->write_cell(20,7,$side,0,0,'C',$fill);
$pdf->line_new();
}
- if ( $idx % 2 == 0 )
- {
- $pdf->SetFillColor(220,221,255);
- $fill=1;
- }
- else
- {
- $pdf->SetFillColor(0,0,0);
- $fill=0;
- }
+ $fill=$pdf->is_fill($idx);
+
$idx++;
// Sum by category
$pdf->write_cell(30,7,"",0,0,'L',$fill);
@@ -173,7 +161,7 @@ else
}
else
{
- $afiche[0] = array('fd_id' => $_REQUEST['cat']);
+ $afiche[0] = array('fd_id' => $http->request('cat'));
}
$fic=new Fiche($cn);
for ($e = 0; $e < count($afiche); $e++)
@@ -194,25 +182,25 @@ else
$fic = new Fiche($cn, $row_fiche['f_id']);
$letter = new Lettering_Card($cn);
$letter->set_parameter('quick_code', $fic->strAttribut(ATTR_DEF_QUICKCODE));
- $letter->set_parameter('start', $_GET['start']);
- $letter->set_parameter('end', $_GET['end']);
+ $letter->set_parameter('start',$http->request('start'));
+ $letter->set_parameter('end',$http->request('end'));
// all
- if ($_GET['histo'] == 0)
+ if ($histo == 0)
{
$letter->get_all();
}
// lettered
- if ($_GET['histo'] == 1)
+ if ($histo == 1)
{
$letter->get_letter();
}
// unlettered
- if ($_GET['histo'] == 2)
+ if ($histo == 2)
{
$letter->get_unletter();
}
- if ($_GET['histo'] == 6)
+ if ($histo == 6)
{
$letter->get_letter_diff();
}
@@ -240,16 +228,7 @@ else
$prog=0;
for ($i = 0; $i < count($letter->content); $i++)
{
- if ($i % 2 == 0)
- {
- $pdf->SetFillColor(220, 221, 255);
- $fill = 1;
- }
- else
- {
- $pdf->SetFillColor(0, 0, 0);
- $fill = 0;
- }
+ $fill=$pdf->is_fill($i);
$pdf->SetFont('DejaVuCond', '', 7);
$row = $letter->content[$i];
$str_date = shrink_date($row['j_date_fmt']);
diff --git a/include/export/export_fiche_pdf.php b/include/export/export_fiche_pdf.php
deleted file mode 100644
index d6efa5d28..000000000
--- a/include/export/export_fiche_pdf.php
+++ /dev/null
@@ -1,233 +0,0 @@
-category, export in PDF the history of a category
- * of card
- * @bug NOT USED MUST BE REMOVED
- */
-if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-// Security we check if user does exist and his privilege
-require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-
-/* Security */
-$gDossier=dossier::id();
-$cn=Dossier::connect();
-$g_user->Check();
-$g_user->check_dossier($gDossier);
-
-$pdf=new PDF($cn);
-$pdf->setDossierInfo(" Periode : ".$_GET['start']." - ".$_GET['end']);
-$pdf->AliasNbPages();
-$pdf->AddPage();
-$name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',array($_GET['cat']));
-$pdf->SetFont('DejaVu','BI',14);
-$pdf->write_cell(0,8,$name,0,1,'C');
-$pdf->SetTitle($name,1);
-$pdf->SetAuthor('NOALYSS');
-$http=new HttpInput();
-$start=$http->request('start');
-$end=$http->request('end');
-if ( isDate($start) == null || isDate ($end) == null ) return;
-
-/* balance */
-if ( $_GET['histo'] == 4 )
-{
- $cat=$http->request('cat');
- $fd=new Fiche_Def($cn,$cat);
- if ( $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false )
- {
- $pdf->write_cell(0,10, _("Cette catégorie n'ayant pas de poste comptable n'a pas de balance"));
- //Save PDF to file
- $fDate=date('dmy-Hi');
- $pdf->Output("category-$fDate.pdf", 'D');
- exit;
- }
- $aCard=$cn->get_array("select f_id,ad_value from fiche join fiche_Detail using (f_id) where ad_id=1 and fd_id=$1 order by 2 ",array($cat));
-
- if ( empty($aCard))
- {
- $pdf->write_cell(0,10, _("Aucune fiche trouvée"));//Save PDF to file
- $fDate=date('dmy-Hi');
- $pdf->Output("category-$fDate.pdf", 'D');
- exit;
- }
- $pdf->SetFont('DejaVuCond','',7);
- $pdf->write_cell(30,7,'Quick Code',0,0,'L',0);
- $pdf->write_cell(80,7,'Libellé',0,0,'L',0);
- $pdf->write_cell(20,7,'Débit',0,0,'R',0);
- $pdf->write_cell(20,7,'Crédit',0,0,'R',0);
- $pdf->write_cell(20,7,'Solde',0,0,'R',0);
- $pdf->write_cell(20,7,'D/C',0,0,'C',0);
- $pdf->line_new();
- $idx=0;
- $filter= " (j_date >= to_date('".$start."','DD.MM.YYYY') ".
- " and j_date <= to_date('".$end."','DD.MM.YYYY')) ";
- for ($i=0;$i < count($aCard);$i++)
- {
- $oCard=new Fiche($cn,$aCard[$i]['f_id']);
- $solde=$oCard->get_solde_detail($filter);
- if ( $solde['debit'] == 0 && $solde['credit']==0) continue;
-
- if ( $idx % 2 == 0 )
- {
- $pdf->SetFillColor(220,221,255);
- $fill=1;
- }
- else
- {
- $pdf->SetFillColor(0,0,0);
- $fill=0;
- }
- $idx++;
-
- $pdf->write_cell(30,7,$oCard->strAttribut(ATTR_DEF_QUICKCODE),0,0,'L',$fill);
- $pdf->write_cell(80,7,$oCard->strAttribut(ATTR_DEF_NAME),0,0,'L',$fill);
- $pdf->write_cell(20,7,sprintf('%.02f',$solde['debit']),0,0,'R',$fill);
- $pdf->write_cell(20,7,sprintf('%.02f',$solde['credit']),0,0,'R',$fill);
- $pdf->write_cell(20,7,sprintf('%.02f',abs($solde['solde'])),0,0,'R',$fill);
- $pdf->write_cell(20,7,(($solde['solde']<0)?'CRED':'DEB'),0,0,'C',$fill);
- $pdf->line_new();
- }
-}
-else
-{
- $array=Fiche::get_fiche_def($cn,$_GET['cat'],'name_asc');
- /*
- * You show now the result
- */
- if ($array == null )
- {
- exit();
- }
- $tab=array(13,25,55,20,20,12,20);
- $align=array('L','L','L','R','R','R','R');
-
- foreach($array as $row_fiche)
- {
- $row=new Fiche($cn,$row_fiche['f_id']);
- $letter=new Lettering_Card($cn);
- $letter->set_parameter('quick_code',$row->strAttribut(ATTR_DEF_QUICKCODE));
- $letter->set_parameter('start',$_GET['start']);
- $letter->set_parameter('end',$_GET['end']);
- // all
- if ( $_GET['histo'] == 0 )
- {
- $letter->get_all();
- }
-
- // lettered
- if ( $_GET['histo'] == 1 )
- {
- $letter->get_letter();
- }
- // unlettered
- if ( $_GET['histo'] == 2 )
- {
- $letter->get_unletter();
- }
- /* skip if nothing to display */
- if (count($letter->content) == 0 ) continue;
- $pdf->SetFont('DejaVuCond','',10);
- $fiche=new Fiche($cn,$row_fiche['f_id']);
- $pdf->write_cell(0,7,$fiche->strAttribut(ATTR_DEF_NAME),1,1,'C');
-
- $pdf->SetFont('DejaVuCond','',7);
-
- $pdf->write_cell($tab[0],7,'Date');
- $pdf->write_cell($tab[1],7,'ref');
- $pdf->write_cell($tab[1],7,'Int.');
- $pdf->write_cell($tab[2],7,'Comm');
- $pdf->write_cell(40,7,'Montant',0,0,'C');
- $pdf->write_cell($tab[5],7,'Let.',0,0,'R');
- $pdf->write_cell($tab[6],7,'Som. Let.',0,0,'R');
- $pdf->line_new();
-
- $amount_deb=0;
- $amount_cred=0;
- for ($i=0;$icontent);$i++)
- {
- if ( $i % 2 == 0 )
- {
- $pdf->SetFillColor(220,221,255);
- $fill=1;
- }
- else
- {
- $pdf->SetFillColor(0,0,0);
- $fill=0;
- }
- $pdf->SetFont('DejaVuCond','',7);
- $row=$letter->content[$i];
- $str_date=shrink_date($row['j_date_fmt']);
-
- $pdf->write_cell($tab[0],4,$str_date,0,0,$align[0],$fill);
- $pdf->write_cell($tab[1],4,$row['jr_pj_number'],0,0,$align[1],$fill);
- $pdf->write_cell($tab[1],4,$row['jr_internal'],0,0,$align[1],$fill);
- $pdf->write_cell($tab[2],4,$row['jr_comment'],0,0,$align[2],$fill);
- if ( $row['j_debit'] == 't')
- {
- $pdf->write_cell($tab[3],4,sprintf('%10.2f',$row['j_montant']),0,0,$align[4],$fill);
- $amount_deb+=$row['j_montant'];
- $pdf->write_cell($tab[4],4,"",0,0,'C',$fill);
- }
- else
- {
- $pdf->write_cell($tab[3],4,"",0,0,'C',$fill);
- $pdf->write_cell($tab[4],4,sprintf('%10.2f',$row['j_montant']),0,0,$align[4],$fill);
- $amount_cred+=$row['j_montant'];
- }
- if ($row['letter'] != -1 )
- {
- $pdf->write_cell($tab[5],4,strtoupper(base_convert($row['letter'],10,36)),0,0,$align[5],$fill);
- // get sum for this lettering
- $sql="select sum(j_montant) from jrnx where j_debit=$1 and j_id in ".
- " (select j_id from jnt_letter join letter_deb using (jl_id) where jl_id=$2 union ".
- " select j_id from jnt_letter join letter_cred using (jl_id) where jl_id=$3)";
- $sum=$cn->get_value($sql,array($row['j_debit'],$row['letter'],$row['letter']));
- $pdf->write_cell($tab[6],4,sprintf('%.2f',$sum),'0','0','R',$fill);
- }
- else
- $pdf->write_cell($tab[5],4,"",0,0,'R',$fill);
- $pdf->line_new();
- }
- $pdf->SetFillColor(0,0,0);
- $pdf->SetFont('DejaVuCond','B',8);
- $debit =sprintf('Debit : % 12.2f',$amount_deb);
- $credit=sprintf('Credit : % 12.2f',$amount_cred);
- if ( $amount_deb>$amount_cred) $s='solde débiteur';
- else $s='solde crediteur';
- $solde =sprintf('%s : % 12.2f',$s,(abs(round($amount_cred-$amount_deb,2))));
-
- $pdf->write_cell(0,6,$debit,0,0,'R');
- $pdf->line_new(4);
- $pdf->write_cell(0,6,$credit,0,0,'R');
- $pdf->line_new(4);
- $pdf->write_cell(0,6,$solde,0,0,'R');
- $pdf->line_new(4);
-
- $pdf->line_new();
- }
-}
-//Save PDF to file
-$fDate=date('dmy-Hi');
-$pdf->Output("category-$fDate.pdf", 'D');
-exit;
diff --git a/include/header_print.php b/include/header_print.php
index 16852c126..90fb24b81 100644
--- a/include/header_print.php
+++ b/include/header_print.php
@@ -35,6 +35,9 @@ function header_txt($p_cn)
$date=date('d / m / Y H:i ');
$dossier=mb_convert_encoding(" Dossier : ".dossier::name(),'ISO-8859-1','UTF-8');
+ // convert to latin1
+ $dossier=iconv('UTF-8','ISO-8859-1//IGNORE',$str);
+
return $dossier." ".$soc." ".$date;
}
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index 93d4ea129..d65c1ed4f 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1374,7 +1374,7 @@ if(!function_exists('tracedebug')) {
}
}
/**
- * @brief encode the string for RTF, return a stringu
+ * @brief encode the string for RTF, return a string
* @param $p_string string to convert
* @return string
*/
@@ -1382,6 +1382,9 @@ function convert_to_rtf($p_string)
{
$result="";
$p_string2=mb_convert_encoding($p_string,'ISO-8859-1','UTF-8');
+ $p_string2=iconv('UTF-8','ISO-8859-1//IGNORE',$p_string);
+
+
$nb_result=strlen($p_string2);
for ($i = 0 ; $i < $nb_result ; $i++ ){
if (ord($p_string[$i]) < 127 ) {
@@ -1413,10 +1416,13 @@ function remove_divide_zero($p_formula)
* @brief Create randomly a string
* @param int $p_length length of the generate string
*/
-function generate_random_string($p_length)
+function generate_random_string($p_length,$special=1)
{
$string="";
- $chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789*/+-=";
+ if ($special == 1)
+ $chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789*/+-=";
+ if ($special == 0)
+ $chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789";
$microtime=microtime(true)*microtime(true)*100;
srand(0);
srand((int)$microtime);
@@ -1660,3 +1666,111 @@ function MaintenanceMode($p_file)
exit;
}
}
+
+/**
+ * @brief returns an double array with the error found and code , if the count is 0 then the password is very string, 5 means it is
+ * empty ,4 weak, ... the array contains the errors, [msg]=>array message [code] => array of code
+ * Codes are
+ * - 1 : too short
+ * - 2 : missing digit
+ * - 3 : missing lowercase letter
+ * - 4 : missing uppercase letter
+ * - 5 : too many time same letter or symbol..
+ * - 6 : missing special char
+ *
+ * If the password is strong returns an empty array
+ *
+ * @param $password string
+ * @code
+
+ $error = check_password_strength($password);
+ if ( count($error['msg']) > 0 ) {
+ echo "password to weak";
+ foreach ($error['msg'] as $item_error) {
+ echo "error $item_error";
+ }
+
+ } else {
+ echo "OK password strong";
+ }
+
+ * @endcode
+ */
+function check_password_strength($password) {
+ $errors=array();
+ $error_code=array();
+
+ $len=strlen($password??"");
+ if ( $len < 8) {
+ $errors[] = _("mot de passe de 8 lettres minimum");
+ $error_code[]=1;
+ }
+
+ if (!preg_match("#[0-9]+#", $password)) {
+ $errors[] = _("mot de passe doit inclure au moins un chiffre");
+ $error_code[]=2;
+ }
+
+ if (!preg_match("#[a-z]+#", $password)) {
+ $errors[] = _("mot de passe doit inclure au moins une minuscule");
+ $error_code[]=3;
+ }
+ if (!preg_match("#[A-Z]+#", $password)) {
+ $errors[] = _("mot de passe doit inclure au moins une majuscule");
+ $error_code[]=4;
+ }
+
+ if ( $len > 0 ) {
+ $cnt_diff=count(count_chars($password,1));
+ $ratio_diff=$len/$cnt_diff;
+
+ if ($ratio_diff > 2) {
+ $errors[] = _("Trop souvent le(s) même(s) symbole(s)");
+ $error_code[]=5;
+ }
+ $special_char=preg_replace('/[[:alnum:]]/','',$password);
+ if ( strlen($special_char??"")==0)
+ {
+ $errors[] = _("mot de passe doit inclure au moins un caractére spécial '+-/*[...'");
+ $error_code[]=6;
+
+ }
+ }
+
+ return array( 'msg'=>$errors, 'code'=>$error_code);
+}
+/**
+ * @brief generate a strong random password
+ * @param $car int length of the password, minimum 8
+ *
+ */
+function generate_random_password($car):string
+{
+ $string="";
+ $car=($car < 8 )?8:$car;
+ $max_loop=20;$loop=0;
+ do
+ {
+ $loop++;
+ $string="";
+ $chaine="abcdefghijklmnpqrstuvwxy";
+ // srand( (int)microtime()*1020030);
+ for ($i=0; $i<$car; $i++)
+ {
+ $string .= $chaine[rand()%strlen($chaine)];
+ }
+ $chaine="ABCDEFGHIJKLMNPQRSTUVWXY";
+ for ($i=0;$i<2;$i++) {
+ $string[rand()%$car]=$chaine[rand()%strlen($chaine)];;
+ }
+ $chaine="0123456789";
+ for ($i=0;$i<2;$i++) {
+ $string[rand()%$car]=$chaine[rand()%strlen($chaine)];;
+ }
+ $special_set="+-/*;,.=:&()[]";
+ $special_car=$special_set[rand()%strlen($special_set)];
+ $string[rand()%$car]=$special_car;
+ // echo $string."\n";
+ }while ( count(check_password_strength($string)['msg'])> 0 && $loop<$max_loop);
+ return $string;
+}
\ No newline at end of file
diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php
index 3f9cba5bd..f4fb785db 100644
--- a/include/lib/database_core.class.php
+++ b/include/lib/database_core.class.php
@@ -169,7 +169,7 @@ class DatabaseCore
return $this;
}
- /**
+ /**
* \brief send a sql string to the database
* \param $p_string sql string
* \param $p_array array for the SQL string (see pg_query_params)
@@ -480,7 +480,7 @@ class DatabaseCore
}
/**
- * Returns only one row from a query
+ * @brief Returns only one row from a query
* @param string $p_sql
* @param array $p_array
* @return array , idx = column of the table or null if nothing is found
@@ -735,7 +735,8 @@ class DatabaseCore
return false;
}
- /**\brief wrapper for the function pg_num_rows
+ /**
+ * \brief wrapper for the function pg_num_rows
* \param $ret is the result of a exec_sql
* \return number of line affected
*/
@@ -745,7 +746,8 @@ class DatabaseCore
return pg_num_rows($ret);
}
- /**\brief wrapper for the function pg_fetch_array
+ /**
+ * \brief wrapper for the function pg_fetch_array
* \param $ret is the result of a pg_exec
* \param $p_indice is the index
* \param $p_indice is the index
@@ -757,7 +759,8 @@ class DatabaseCore
return pg_fetch_array($ret, $p_indice,$p_mode);
}
- /**\brief wrapper for the function pg_fetch_all
+ /**
+ * \brief wrapper for the function pg_fetch_all
* \param $ret is the result of pg_exec (exec_sql)
* \return double array (row x col ) or false
*/
@@ -767,7 +770,8 @@ class DatabaseCore
return pg_fetch_all($ret);
}
- /**\brief wrapper for the function pg_fetch_all
+ /**
+ * \brief wrapper for the function pg_fetch_all
* \param $ret is the result of pg_exec (exec_sql)
* \param $p_row is the indice of the row
* \param $p_col is the indice of the col
@@ -790,7 +794,8 @@ class DatabaseCore
return pg_fetch_row($ret, $p_row);
}
- /**\brief wrapper for the function pg_lo_unlink
+ /**
+ * \brief wrapper for the function pg_lo_unlink
* \param $p_oid is the of oid
* \return return the result of the operation
*/
@@ -838,7 +843,8 @@ class DatabaseCore
return pg_lo_export($this->db, $p_oid, $tmp_file);
}
- /**\brief wrapper for the function pg_lo_export
+ /**
+ * \brief wrapper for the function pg_lo_export
* \param $p_filename is the filename
* \param $tmp is the file
* \return result of the operation
@@ -849,7 +855,8 @@ class DatabaseCore
return pg_lo_import($this->db, $p_filename);
}
- /**\brief wrapper for the function pg_escape_string
+ /**
+ * \brief wrapper for the function pg_escape_string
* \param $p_string is the string to escape
* \return escaped string
*/
@@ -861,7 +868,8 @@ class DatabaseCore
return pg_escape_string($cn->db,$p_string);
}
- /**\brief wrapper for the function pg_close
+ /**
+ * \brief wrapper for the function pg_close
*/
function close()
@@ -870,7 +878,8 @@ class DatabaseCore
$this->is_open = FALSE;
}
- /**\brief
+ /**
+ * \brief
* \param
* \return
* \note
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index 2f63464e6..4250f9394 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -101,7 +101,8 @@ class HtmlInput
$this->readOnly=$p_read;
}
- /*!\brief set the extra javascript property for the INPUT field
+ /*!
+ * \brief set the extra javascript property for the INPUT field
* \param $p_name name of the parameter
* \param $p_value default value of this parameter
*/
@@ -439,7 +440,7 @@ class HtmlInput
}
/**
- * close button for the HTML popup
+ * @brief close button for the HTML popup
* @see add_div modify_operation
* @param $div_name is the name of the div to remove
*/
@@ -469,7 +470,7 @@ class HtmlInput
}
/**
- * Return a html string with an anchor which close the inside popup. (top-right corner)
+ * @brief Return a html string with an anchor which close the inside popup. (top-right corner)
* @param name of the DIV to close
* @deprecated
* @see Icon_Action::close
@@ -480,7 +481,7 @@ class HtmlInput
}
/**
- * Anchor Html with javascript
+ * @brief Anchor Html with javascript
* @param $action action action to perform (message) without onclick
* @param $javascript javascript to execute
* @param $id is the DOM element id
@@ -500,7 +501,7 @@ class HtmlInput
}
/**
- * button Html with javascript
+ * @brief button Html with javascript
* @param $action action action to perform (message) without onclick
* @param $javascript javascript to execute
* @param $id is the DOM element id
@@ -520,7 +521,7 @@ class HtmlInput
}
/**
- * Image to click ,
+ * @brief Image to click ,
* @param string $p_image filename of the image under image/
* @param string $p_js javascript when the image is clicked
* @param string $p_message Message
@@ -533,7 +534,7 @@ class HtmlInput
}
/**
- * button Html image
+ * @brief button Html image
* @param $javascript javascript to execute
* @param $id id of the button
* @param $class class of the button
@@ -552,7 +553,7 @@ class HtmlInput
}
/**
- * Return a html string with an anchor to hide a div, put it in the right corner
+ * @brief Return a html string with an anchor to hide a div, put it in the right corner
* @param $action action action to perform (message)
* @param $javascript javascript
* @note not protected against html
@@ -576,7 +577,7 @@ class HtmlInput
}
/**
- * show the detail of a card
+ * @brief show the detail of a card
*/
static function card_detail($p_qcode, $pname='', $p_style="",
$p_nohistory=false)
@@ -590,7 +591,7 @@ class HtmlInput
}
/**
- * transform request data to hidden
+ * @brief transform request data to hidden
* @param $array is an of indices
* @param $request name of the superglobal $_POST $_GET $_REQUEST(default)
* @return html string with the hidden data
@@ -624,7 +625,7 @@ class HtmlInput
return $r;
}
/**
- * Transform a double array as a HTML string with hidden html value
+ * @brief Transform a double array as a HTML string with hidden html value
* array has the formarray ["name"]="x",array['value']="y") the key name will be the hidden input name;
* @param double $array
*/
@@ -651,7 +652,7 @@ class HtmlInput
}
/**
- * transform $_GET data to hidden
+ * @brief transform $_GET data to hidden
* @param $array is an of indices
* @see HtmlInput::request_to_hidden
* @return html string with the hidden data
@@ -1166,7 +1167,7 @@ class HtmlInput
}
/**
- * Insert attribute inside a INPUT TYPE, these attribute can be retrieved
+ * @brief Insert attribute inside a INPUT TYPE, these attribute can be retrieved
* in javascript with element.getAttribute or changed with element.setAttribute
* example insert my_attribute into a checkbox
* @return string to insert into the HTML node
diff --git a/include/lib/inplace_edit.class.php b/include/lib/inplace_edit.class.php
index 6e631320e..dd22acafd 100644
--- a/include/lib/inplace_edit.class.php
+++ b/include/lib/inplace_edit.class.php
@@ -30,7 +30,11 @@
* You need an ajax to response and modify the data. Some parameters will be sent
* by default when you click on the element
* - input : htmlInput object serialized
- * - action : ok or cancel , nothing if you just want to display the input
+ * - ieaction : ok or cancel , nothing if you just want to display the input
+ *
+ * Very important it is the DOM ID of the HtmlInput element, it must unique. For the date
+ * set a uniq dom id, otherwise it fails
+ * $id_limit_date->id=uniqid("date");
*
* @example inplace_edit.test.php
*/
@@ -111,7 +115,7 @@ EOF;
function value()
{
$v=$this->input->get_value();
- $v=html_entity_decode($v);
+ $v=html_entity_decode($v??"");
if ( $this->input instanceof ITextarea) {
echo '
';
diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php
index 4eed7759b..e0f2b6b39 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -75,6 +75,26 @@
* @endcode
*
+ * The afterSaveFct is the function called after saving, the param is the HTML Element
+ @code PHP
+// to redirect : we take the pk_id and redirect to another location
+
+ $obj=$this->get_object_name();
+ $url=DRIVINGSCHOOL_URL;
+ $script=<<a_order);
$virg=""; $result="";
+
// filter only on visible column
- $visible=0;
+ $visible=($this->icon_mod=='left')?1:0;
+ $visible=$visible+( ($this->icon_del=='left')?1:0);
for ($e=0; $e<$nb_order; $e++)
{
if ($this->get_property_visible($this->a_order[$e])==TRUE)
diff --git a/include/lib/pdf_core.class.php b/include/lib/pdf_core.class.php
index d46355f3c..3b4563889 100644
--- a/include/lib/pdf_core.class.php
+++ b/include/lib/pdf_core.class.php
@@ -264,7 +264,7 @@ class PDF_Core extends TFPDF
$this->bigger=0;
}
/**
- * If the step is even then return 1 and set the backgroup color to blue , otherwise
+ * @brief If the step is even then return 1 and set the backgroup color to blue , otherwise
* returns 0, and set the background color to white
* It is use to compute alternated colored row , it the parameter fill in write_cell and
* cell
@@ -281,7 +281,7 @@ class PDF_Core extends TFPDF
$this->SetFillColor(255, 255, 255);
$fill = 0;
}
- return $p_step;
+ return $fill;
}
diff --git a/include/recover.php b/include/recover.php
index 026863f65..ed8d7ad47 100644
--- a/include/recover.php
+++ b/include/recover.php
@@ -17,27 +17,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2014) Author Dany De Bontridder
+require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
if (!defined('RECOVER'))
die('Appel direct ne sont pas permis');
define('SIZE_REQUEST', 70);
-/**
- * @brief generate a random string of char
- * @param $car int length of the string
- */
-function generate_random($car)
-{
- $string="";
- $chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789";
- srand((double) microtime()*1020030);
- for ($i=0; $i<$car; $i++)
- {
- $string .= $chaine[rand()%strlen($chaine)];
- }
- return $string;
-}
+
$http=new HttpInput();
/**
* @file
@@ -89,8 +76,8 @@ elseif ($action=="send_email") :
if ($valid==true):
- $request_id=generate_random(SIZE_REQUEST);
- $user_password=generate_random(10);
+ $request_id=generate_random_string(SIZE_REQUEST,special: 0);
+ $user_password=generate_random_password(10);
// exist a valid request for this user ?
$exist_request= $cn->get_array("select request , password from recover_pass
where use_id=$1 and created_on > now() - interval '12 hours'",[$user_id]);
diff --git a/include/sql/patch/upgrade189.sql b/include/sql/patch/upgrade189.sql
new file mode 100644
index 000000000..ef3abe35a
--- /dev/null
+++ b/include/sql/patch/upgrade189.sql
@@ -0,0 +1,6 @@
+begin;
+
+delete from menu_ref where me_code='PDF:fiche';
+
+insert into version (val,v_description) values (190,'remove dead code');
+commit;
\ No newline at end of file
diff --git a/include/template/ledger_search.php b/include/template/ledger_search.php
index a5ac3bba8..6a8010f03 100644
--- a/include/template/ledger_search.php
+++ b/include/template/ledger_search.php
@@ -1,7 +1,7 @@