[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 08/09: Remove dead code
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 08/09: Remove dead code |
Date: |
Sun, 17 Sep 2023 15:06:14 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 1c99430ecf1a208570fee6b62fed14be50676a09
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Sep 15 19:23:34 2023 +0200
Remove dead code
remove dead code : useless file and menu
---
include/constant.php | 2 +-
include/export/export_fiche_pdf.php | 233 ------------------------------------
include/sql/patch/upgrade189.sql | 6 +
3 files changed, 7 insertions(+), 234 deletions(-)
diff --git a/include/constant.php b/include/constant.php
index 6e2607785..a5fd19ee9 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -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_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 @@
-<?php
-/*
- * This file is part of NOALYSS.
- *
- * NOALYSS is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * NOALYSS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with NOALYSS; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-// Copyright Author Dany De Bontridder danydb@aevalys.eu
-
-/*!\file
- * \brief Called by impress->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;$i<count($letter->content);$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/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
- [Noalyss-commit] [noalyss] branch master updated (b77ac34d8 -> 4bf2ca815), dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 07/09: Comptability PHP8.1, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 01/09: PHP8.1 deprecated, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 05/09: Default currency, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 06/09: correct global g_parameter, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 02/09: compatibility PHP8.1, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 08/09: Remove dead code,
dwm <=
- [Noalyss-commit] [noalyss] 03/09: Bug cannot update description in FOLLOW->event, dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 04/09: Merge branch 'patch-230902', dwm, 2023/09/17
- [Noalyss-commit] [noalyss] 09/09: task #2297: Suppression $_REQUEST dossier.class.php, dwm, 2023/09/17