Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss

This commit is contained in:
Dany De Bontridder 2019-07-29 11:01:25 +02:00
commit 2c51a53a1e
99 changed files with 1168 additions and 436 deletions

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -30,7 +30,7 @@ require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
/**
* @class
* @brief Print the crossed balance between 2 plan

View file

@ -27,7 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdfbalance_simple.class.php';
require_once NOALYSS_INCLUDE.'/header_print.php';
/*! \brief manage the simple balance for CA, inherit from balance_ca
*

View file

@ -112,5 +112,135 @@ class Database extends DatabaseCore
return $Res;
}
/**
* \brief loop to apply all the path to a folder or
* a template
* \param $p_name database name
*
*/
function apply_patch($p_name)
{
if (!$this->exist_table('version')) {
echo _('Base de donnée vide');
return;
}
$MaxVersion = DBVERSION - 1;
$succeed = "<span style=\"font-size:18px;color:green\">&#x2713;</span>";
echo '<ul style="list-type-style:square">';
for ($i = 4; $i <= $MaxVersion; $i++) {
$to = $i + 1;
if ($this->get_version() <= $i) {
if ($this->get_version() == 97) {
if ($this->exist_schema("amortissement")) {
$this->exec_sql('ALTER TABLE amortissement.amortissement_histo
ADD CONSTRAINT internal_fk FOREIGN KEY (jr_internal) REFERENCES jrn (jr_internal)
ON UPDATE CASCADE ON DELETE SET NULL');
}
}
echo "<li>Patching " . $p_name .
" from the version " . $this->get_version() . " to $to ";
$this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade' . $i . '.sql');
echo $succeed;
if (!DEBUG)
ob_start();
// specific for version 4
if ($i == 4) {
$sql = "select jrn_def_id from jrn_def ";
$Res = $this->exec_sql($sql);
$Max = $this->size();
for ($seq = 0; $seq < $Max; $seq++) {
$row = pg_fetch_array($Res, $seq);
$sql = sprintf("create sequence s_jrn_%d", $row['jrn_def_id']);
$this->exec_sql($sql);
}
}
// specific to version 7
if ($i == 7) {
// now we use sequence instead of computing a max
//
$Res2 = $this->exec_sql('select coalesce(max(jr_grpt_id),1) as l from jrn');
$Max2 = pg_NumRows($Res2);
if ($Max2 == 1) {
$Row = pg_fetch_array($Res2, 0);
var_dump($Row);
$M = $Row['l'];
$this->exec_sql("select setval('s_grpt',$M,true)");
}
}
// specific to version 17
if ($i == 17) {
$this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade17.sql');
$max = $this->get_value('select last_value from s_jnt_fic_att_value');
$this->alter_seq($p_cn, 's_jnt_fic_att_value', $max + 1);
} // version
// reset sequence in the modele
//--
if ($i == 30 && $p_name == "mod") {
$a_seq = array('s_jrn', 's_jrn_op', 's_centralized',
's_stock_goods', 'c_order', 's_central');
foreach ($a_seq as $seq) {
$sql = sprintf("select setval('%s',1,false)", $seq);
$Res = $this->exec_sql($sql);
}
$sql = "select jrn_def_id from jrn_def ";
$Res = $this->exec_sql($sql);
$Max = pg_NumRows($Res);
for ($seq = 0; $seq < $Max; $seq++) {
$row = pg_fetch_array($Res, $seq);
$sql = sprintf("select setval('s_jrn_%d',1,false)", $row['jrn_def_id']);
$this->exec_sql($sql);
}
}
if ($i == 36) {
/* check the country and apply the path */
$res = $this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
$country = pg_fetch_result($res, 0, 0);
$this->execute_script(NOALYSS_INCLUDE . "/sql/patch/upgrade36." . $country . ".sql");
$this->exec_sql('update tmp_pcmn set pcm_type=find_pcm_type(pcm_val)');
}
if ($i == 59) {
$res = $this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
$country = pg_fetch_result($res, 0, 0);
if ($country == 'BE')
$this->exec_sql("insert into parm_code values ('SUPPLIER',440,'Poste par défaut pour les fournisseurs')");
if ($country == 'FR')
$this->exec_sql("insert into parm_code values ('SUPPLIER',400,'Poste par défaut pour les fournisseurs')");
}
if ($i == 61) {
$country = $this->get_value("select pr_value from parameter where pr_id='MY_COUNTRY'");
$this->execute_script(NOALYSS_INCLUDE . "/sql/patch/upgrade61." . $country . ".sql");
}
if (!DEBUG)
ob_end_clean();
}
}
echo '</ul>';
}
/**
* return the name of the database with the domain name
* @param $p_id of the folder WITHOUT the domain name
* @param $p_type dos for folder mod for template
* @return formatted name
*/
function format_name($p_id, $p_type)
{
switch ($p_type) {
case 'dos':
$sys_name = sprintf("%sdossier%d", strtolower(domaine), $p_id);
break;
case 'mod':
$sys_name = sprintf("%smod%d", strtolower(domaine), $p_id);
break;
default:
echo_error(__FILE__ . " format_name invalid type " . $p_type, __LINE__);
throw new Exception(__FILE__ . " format_name invalid type " . $p_type . __LINE__);
}
return $sys_name;
}
}

View file

@ -20,13 +20,13 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/* !\file
/*!\file
* \brief the class for the dossier, everywhere we need to know to
* which folder we are connected, because we can't use $_SESSION, we
* need to pass the dossier_id via a _GET or a POST variable
*/
/* ! \brief manage the current dossier, everywhere we need to know to
/*! \brief manage the current dossier, everywhere we need to know to
* which folder we are connected, because we can't use $_SESSION, we
* need to pass the dossier_id via a _GET or a POST variable
* private static $variable=array("id"=>"dos_id",
@ -52,7 +52,7 @@ class Dossier
$this->dos_id=$p_id;
}
/* !\brief return the $_REQUEST['gDossier'] after a check */
/*!\brief return the $_REQUEST['gDossier'] after a check */
static function id()
{
@ -127,7 +127,7 @@ class Dossier
return $nb_folder;
}
/* !
/*!
* \brief Return all the users
* as an array
*/
@ -161,7 +161,7 @@ class Dossier
return $res;
}
/* !\brief check if gDossier is set */
/*!\brief check if gDossier is set */
static function check()
{
@ -177,7 +177,7 @@ class Dossier
exit('gDossier Invalide : '.$id);
}
/* !
/*!
* \brief return a string to put to gDossier into a GET
*/
@ -187,7 +187,7 @@ class Dossier
return "gDossier=".$_REQUEST['gDossier'];
}
/* !\brief return a string to set gDossier into a FORM */
/*!\brief return a string to set gDossier into a FORM */
static function hidden()
{
@ -195,7 +195,7 @@ class Dossier
return '<input type="hidden" id="gDossier" name="gDossier" value="'.$_REQUEST['gDossier'].'">';
}
/* !\brief retrieve the name of the current dossier */
/*!\brief retrieve the name of the current dossier */
static function name($id=0)
{

View file

@ -20,11 +20,11 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/* !\file
/*!\file
* \brief the extension class manages the plugins for the security, the access
* the inclusion...
*/
/* !\brief manage the extension, it involves the table extension
/*!\brief manage the extension, it involves the table extension
*
* Data member
* - $cn database connection
@ -57,7 +57,7 @@ class Extension extends Menu_Ref_sql
throw new Exception('Extension non trouvée, le chemin est-il correct?');
}
/* !@brief search a extension, the what is the column (extends_code */
/*!@brief search a extension, the what is the column (extends_code */
function search($p_what)
{
@ -67,7 +67,7 @@ class Extension extends Menu_Ref_sql
return 1;
}
/* !\brief return 1 if the user given in parameter can access this extension
/*!\brief return 1 if the user given in parameter can access this extension
* otherwise returns 0
* \param $p_login the user login
* \return 1 has access, 0 has no access
@ -86,7 +86,7 @@ class Extension extends Menu_Ref_sql
return 0;
}
/* !@brief make an array of the available plugin for the current user
/*!@brief make an array of the available plugin for the current user
* @return an array
* @see ISelect
*/

View file

@ -184,7 +184,7 @@ class Fiche
{
/*
* !! Missing attribute
*!! Missing attribute
*/
foreach ($e->attribut as $f )
{

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

144
include/class/pdf.class.php Normal file
View file

@ -0,0 +1,144 @@
<?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@noalyss.eu
/*!\file
* \brief API for creating PDF, unicode, based on tfpdf
*@see TFPDF
*/
require_once NOALYSS_INCLUDE."/lib/pdf_core.class.php";
class PDF extends PDF_Core
{
var $cn = null;
var $own = null;
var $soc = "";
var $dossier = "n/a";
var $date = "";
function __construct(Database $p_cn , $orientation = 'P', $unit = 'mm', $format = 'A4')
{
$this->cn = $p_cn;
$this->own = new Noalyss_Parameter_Folder($this->cn);
$this->soc = $this->own->MY_NAME;
$this->date = date('d.m.Y');
parent::__construct($orientation,$unit,$format);
date_default_timezone_set ('Europe/Paris');
}
function setDossierInfo($dossier = "n/a")
{
$this->dossier = dossier::name()." ".$dossier;
}
function Header()
{
//Arial bold 12
$this->SetFont('DejaVu', 'B', 12);
//Title
parent::Cell(0,10,$this->dossier, 'B', 0, 'C');
//Line break
parent::Ln(20);
}
function Footer()
{
//Position at 2 cm from bottom
$this->SetY(-20);
//Arial italic 8
$this->SetFont('Arial', '', 8);
//Page number
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');
}
/**
*@brief retrieve the client name and quick_code
*@param $p_jr_id jrn.jr_id
*@param $p_jrn_type ledger type ACH VEN FIN
*@return array (0=>qcode,1=>name) or for FIN 0=>customer qc 1=>customer name 2=>bank qc 3=>bank name
*@see class_print_ledger_simple, class_print_ledger_simple_without_vat
*/
function get_tiers($p_jr_id,$p_jrn_type)
{
if ( $p_jrn_type=='ACH' )
{
$array=$this->cn->get_array('SELECT
jrnx.j_grpt,
quant_purchase.qp_supplier,
quant_purchase.qp_internal,
jrn.jr_internal
FROM
public.quant_purchase,
public.jrnx,
public.jrn
WHERE
quant_purchase.j_id = jrnx.j_id AND
jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
if (count($array)==0) return array("ERREUR $p_jr_id",'');
$customer_id=$array[0]['qp_supplier'];
$fiche=new Fiche($this->cn,$customer_id);
$customer_qc=$fiche->get_quick_code($customer_id);
$customer_name=$fiche->getName();
return array($customer_qc,$customer_name);
}
if ( $p_jrn_type=='VEN' )
{
$array=$this->cn->get_array('SELECT
quant_sold.qs_client
FROM
public.quant_sold,
public.jrnx,
public.jrn
WHERE
quant_sold.j_id = jrnx.j_id AND
jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
if (count($array)==0) return array("ERREUR $p_jr_id",'');
$customer_id=$array[0]['qs_client'];
$fiche=new Fiche($this->cn,$customer_id);
$customer_qc=$fiche->get_quick_code($customer_id);
$customer_name=$fiche->getName();
return array($customer_qc,$customer_name);
}
if ( $p_jrn_type=='FIN' )
{
$array=$this->cn->get_array('SELECT
qf_other,qf_bank
FROM
public.quant_fin
WHERE
quant_fin.jr_id =$1',array($p_jr_id));
if (count($array)==0) return array("ERREUR $p_jr_id",'','','');
$customer_id=$array[0]['qf_other'];
$fiche=new Fiche($this->cn,$customer_id);
$customer_qc=$fiche->get_quick_code($customer_id);
$customer_name=$fiche->getName();
$bank_id=$array[0]['qf_bank'];
$fiche=new Fiche($this->cn,$bank_id);
$bank_qc=$fiche->get_quick_code($bank_id);
$bank_name=$fiche->getName();
return array($customer_qc,$customer_name,$bank_qc,$bank_name);
}
}
}

View file

@ -0,0 +1,71 @@
<?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@noalyss.eu
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class PDFLand extends PDF
{
public function __construct ($p_cn = null, $orientation = 'P', $unit = 'mm', $format = 'A4')
{
if($p_cn == null) die("No database connection. Abort.");
$this->bigger=0;
parent::__construct($p_cn,'L', $unit, $format);
date_default_timezone_set ('Europe/Paris');
$this->AddFont('DejaVu','','DejaVuSans.ttf',true);
$this->AddFont('DejaVu','B','DejaVuSans-Bold.ttf',true);
$this->AddFont('DejaVu','BI','DejaVuSans-BoldOblique.ttf',true);
$this->AddFont('DejaVuCond','','DejaVuSansCondensed.ttf',true);
$this->AddFont('DejaVuCond','B','DejaVuSansCondensed-Bold.ttf',true);
$this->AddFont('DejaVuCond','I','DejaVuSansCondensed-Oblique.ttf',true);
$this->cn = $p_cn;
$this->own = new Noalyss_Parameter_Folder($this->cn);
$this->soc = $this->own->MY_NAME;
$this->date = date('d.m.Y');
}
function Header()
{
//Arial bold 12
$this->SetFont('DejaVu', 'B', 10);
//Title
$this->Cell(0,10,$this->dossier, 'B', 0, 'C');
//Line break
$this->Ln(20);
}
function Footer()
{
//Position at 2 cm from bottom
$this->SetY(-20);
//Arial italic 8
$this->SetFont('DejaVuCond', 'I', 8);
//Page number
$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');
}
}

View file

@ -25,7 +25,7 @@
* Detail Operation ACC + ANC , it will use Acc_Operation and Anc_Operation
*
*/
require_once NOALYSS_INCLUDE . '/lib/pdf.class.php';
require_once NOALYSS_INCLUDE . '/class/pdf.class.php';
require_once NOALYSS_INCLUDE . '/class/acc_operation.class.php';
require_once NOALYSS_INCLUDE . '/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE . '/class/acc_operation.class.php';

View file

@ -0,0 +1,63 @@
<?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@noalyss.eu
require_once NOALYSS_INCLUDE."/class/pdf.class.php";
class PDFBalance_simple extends PDF
{
/**
*@brief set_info(dossier,from poste,to poste, from periode, to periode)
*@param $p_from_poste start = poste
*@param $p_to_poste end = poste
*@param $p_from periode start
*@param $p_to periode end
*/
function set_info($p_from_poste,$to_poste,$p_from,$p_to)
{
$this->dossier=sprintf(_('Balance simple %s'),dossier::name());
$this->from_poste=$p_from_poste;
$this->to_poste=$to_poste;
$this->from=$p_from;
$this->to=$p_to;
}
function Header()
{
parent::Header();
$this->SetFont('DejaVu','B',8);
$titre=sprintf(_("Balance simple poste %s %s date %s %s"),
$this->from_poste,
$this->to_poste,
$this->from,
$this->to);
$this->Cell(0,7,$titre,1,0,'C');
$this->Ln();
$this->SetFont('DejaVu','',6);
$this->Cell(110,7,_('Poste Comptable'),'B');
$this->Cell(20,7,_('Débit'),'B',0,'L');
$this->Cell(20,7,_('Crédit'),'B',0,'L');
$this->Cell(20,7,_('Solde'),'B',0,'L');
$this->Cell(20,7,_('D/C'),'B',0,'L');
$this->Ln();
}
}

View file

@ -20,10 +20,10 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/* !\file
/*!\file
* \brief definition of the class periode
*/
/* !
/*!
* \brief For the periode tables parm_periode and jrn_periode
*/
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
@ -33,13 +33,13 @@ require_once NOALYSS_INCLUDE."/database/parm_periode_sql.class.php";
class Periode
{
var $cn; /* !< database connection */
var $jrn_def_id; /* !< the jr, 0 means all the ledger */
var $p_id; /* !< pk of parm_periode */
var $status; /* !< status is CL for closed, OP for
var $cn; /*!< database connection */
var $jrn_def_id; /*!< the jr, 0 means all the ledger */
var $p_id; /*!< pk of parm_periode */
var $status; /*!< status is CL for closed, OP for
open and CE for centralized */
var $p_start; /* !< start of the periode */
var $p_end; /* !< end of the periode */
var $p_start; /*!< start of the periode */
var $p_end; /*!< end of the periode */
function __construct($p_cn, $p_id=0)
{
@ -58,7 +58,8 @@ class Periode
$this->p_id=$pp_id;
}
/* !\brief return the p_id of the start and the end of the exercice
/**
* \brief return the p_id of the start and the end of the exercice
* into an array
* \param $p_exercice
* \return array [start]=>,[end]=>
@ -73,7 +74,8 @@ class Periode
return array("start"=>$start, "end"=>$end);
}
/* !\brief check if a periode is closed. If jrn_def_id is set to a no zero value then check only for this ledger
/*!
* \brief check if a periode is closed. If jrn_def_id is set to a no zero value then check only for this ledger
* @see Periode::set_ledger
* \return 1 is the periode is closed otherwise return 0
*/
@ -274,7 +276,7 @@ class Periode
}
}
/* !\brief load data from database
/*!\brief load data from database
* \return 0 on success and -1 on error
*/
@ -295,7 +297,7 @@ class Periode
return 0;
}
/* !\brief return the max and the min periode of the exercice given
/*!\brief return the max and the min periode of the exercice given
* in parameter
* \param $p_exercice is the exercice
* \return an array of Periode object
@ -319,7 +321,7 @@ class Periode
return array($rMax, $rMin);
}
/* !
/*!
* \brief Give the start & end date of a periode
* \param $p_periode is the periode id, if omitted the value is the current object
* \return array containing the start date & the end date, index are p_start and p_end or NULL if
@ -344,7 +346,7 @@ class Periode
return Database::fetch_array($Res, 0);
}
/* !\brief return the first day of periode
/*!\brief return the first day of periode
* the this->p_id must be set
* \return a string with the date (DD.MM.YYYY)
*/
@ -357,7 +359,7 @@ class Periode
return $p_start;
}
/* !\brief return the last day of periode
/*!\brief return the last day of periode
* the this->p_id must be set
* \return a string with the date (DD.MM.YYYY)
*/
@ -381,7 +383,7 @@ class Periode
return Database::fetch_result($Res, 0, 0);
}
/* !\brief retrieve the periode thanks the date_end
/*!\brief retrieve the periode thanks the date_end
* \param $p_date format DD.MM.YYYY
* \return the periode id
* \exception if not periode is found or if more than one periode is found

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -23,7 +23,7 @@
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*/
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf_land.class.php';
class Print_Ledger_Detail extends PDF
{

View file

@ -22,7 +22,7 @@
/*!\file
* \brief print a listing of financial
*/
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Financial extends PDF
{
private $rap_amount; /* amount from begining exercice */

View file

@ -22,7 +22,7 @@
/*!\file
* \brief print a listing of financial
*/
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Misc extends PDF
{
function __construct($p_cn,$p_jrn)

View file

@ -23,7 +23,7 @@
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*/
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Simple extends PDF
{

View file

@ -23,7 +23,7 @@
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*/
require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Simple_Without_Vat extends PDF
{

View file

@ -0,0 +1,132 @@
<?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@noalyss.eu
/*!\file
* \brief Send email for Noalyss after checking if it is possible : if cannot be sent if the limit of max email
* is reached,
* @see sendmail_core
*/
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE."/lib/sendmail_core.class.php";
class Sendmail extends Sendmail_Core
{
/**
* Send the message
* @throws Exception
*/
function send()
{
if ( $this->can_send() == false ) throw new Exception(_('Email non envoyé'),EMAIL_LIMIT);
if (!mail($this->mailto, $this->subject, $this->content,$this->header))
{
throw new Exception('send failed');
}
// Increment email amount
$repo =new Database();
$date=date('Ymd');
$http=new HttpInput();
$dossier=$http->request("gDossier","string", -1);
$this->increment_mail($repo,$dossier,$date);
}
/**
* Check if email can be sent from a folder
* @return boolean
*/
function can_send() {
/**
* if send from a dossier , then check limit of this dossier
* otherwise send true
*/
$http=new HttpInput();
$dossier=$http->request("gDossier","string", -1);
if ($dossier == -1 ) return true;
/**
* Compare max value in repo
*/
$repo =new Database();
$date=date('Ymd');
// get max email
$max_email = $this->get_max_email($repo,$dossier);
//
// This folder cannot send email
if ($max_email == 0 ) return false;
//
// This folder has unlimited email
if ($max_email == -1 ) return true;
// get email sent today from account_repository
$email_sent = $this->get_email_sent($repo,$dossier , $date);
//
if ( $email_sent >= $max_email) return false;
return true;
}
/**
* return max email the folder can send
* @param $p_repo Database
* @param $p_dossier_id int
*/
function get_max_email(Database $p_repo,$p_dossier_id)
{
$max_email = $p_repo->get_value("select dos_email from ac_dossier where dos_id=$1",
array($p_dossier_id));
return $max_email;
}
/**
* Return the amount of send emails for the date (YYYYMMDD)
* @param Database $p_repo
* @param $p_dossier_id int
* @param $p_date string YYYYMMDD
*/
function get_email_sent(Database $p_repo,$p_dossier_id,$p_date)
{
$email_sent = $p_repo->get_value ('select de_sent_email from dossier_sent_email where dos_id = $1 and de_date=$2',
array($p_dossier_id,$p_date));
return $email_sent;
}
/**
* Add $p_amount_email to email sent
* @param $p_repo Database
* @param $p_dossier int id of the folder (dossier.dos_id)
* @param $p_date string (YYYYMMDD)
*/
function increment_mail(Database $p_repo,$p_dossier,$p_date)
{
if ( $p_dossier == -1) return ;
$email_sent = $this->get_email_sent($p_repo,$p_dossier,$p_date);
if ( $email_sent == 0 ){
$p_repo->exec_sql("insert into public.dossier_sent_email(de_sent_email,dos_id,de_date) values($1,$2,$3)",
array(1,$p_dossier,$p_date));
return;
} else {
// update + sp_emaoun_email
$p_repo->exec_sql("update dossier_sent_email set de_sent_email=de_sent_email+1 where dos_id=$1 and de_date=$2",
array($p_dossier,$p_date));
}
}
}

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.

View file

@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* 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.