Merge branch 'devel'
This commit is contained in:
commit
aca73ffa04
71 changed files with 4485 additions and 1660 deletions
|
|
@ -327,7 +327,23 @@ $path = array(
|
|||
//visibility quantity
|
||||
"update_visibility_quantity"=>"ajax_update_visibility_quantity",
|
||||
// detail customer , supplier operation
|
||||
"event_display_detail"=>"ajax_event_display_detail"
|
||||
"event_display_detail"=>"ajax_event_display_detail",
|
||||
// update periode in opening operation
|
||||
"operation_exercice+update_periode"=>"ajax_operation_exercice",
|
||||
// modify row in exercice (opening/closing) operation
|
||||
"operation_exercice+modify_row"=>"ajax_operation_exercice",
|
||||
// save row in exercice (opening/closing) operation
|
||||
"operation_exercice+save_row"=>"ajax_operation_exercice",
|
||||
// compute the balance after saving row in exercice (opening/closing) operation
|
||||
"operation_exercice+display_total"=>"ajax_operation_exercice",
|
||||
// delete row in exercice (opening/closing) operation
|
||||
"operation_exercice+delete_row"=>"ajax_operation_exercice",
|
||||
// date in exercice (opening/closing) operation
|
||||
"operation_exercice+date"=>"ajax_operation_exercice",
|
||||
// text in exercice (opening/closing) operation
|
||||
"operation_exercice+text"=>"ajax_operation_exercice",
|
||||
// transfer operation to accountancy
|
||||
'operation_exercice+transfer'=>"ajax_operation_exercice",
|
||||
) ;
|
||||
|
||||
if (array_key_exists($op, $path)) {
|
||||
|
|
|
|||
|
|
@ -3393,6 +3393,7 @@ li.li-active {
|
|||
*/
|
||||
#info_passid {
|
||||
position:absolute;
|
||||
background-color: yellow;
|
||||
background-color: rgba(246, 180, 157, 0.58);
|
||||
color:red;
|
||||
|
||||
}
|
||||
|
|
@ -36,11 +36,16 @@ require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
|
|||
MaintenanceMode("block.html");
|
||||
|
||||
global $g_user,$cn,$g_parameter;
|
||||
$cn=Dossier::connect();
|
||||
$g_parameter=new Noalyss_Parameter_Folder($cn);
|
||||
|
||||
$http=new HttpInput();
|
||||
$cn=Dossier::connect();
|
||||
$g_user=new Noalyss_user($cn);
|
||||
$g_user->check();
|
||||
$only_plugin=$g_user->check_dossier(dossier::id());
|
||||
|
||||
|
||||
set_language();
|
||||
$ext=new Extension($cn);
|
||||
|
||||
|
|
|
|||
|
|
@ -376,10 +376,10 @@ if (!defined('PHP_VERSION_ID')) {
|
|||
|
||||
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 ));
|
||||
}
|
||||
if ( PHP_VERSION_ID < 70400) {
|
||||
echo $g_failed. " ".phpversion()." ". _("Version PHP trop basse , minimum 7.4");
|
||||
if ( PHP_VERSION_ID < 80000) {
|
||||
echo $g_failed. " ".phpversion()." ". _("Version PHP trop basse , minimum 8.0");
|
||||
echo '<p style="color:grey;margin-left:20px">';
|
||||
printf(_("Il est déconseillé de travailler avec une version < 7.4"));
|
||||
printf(_("Il est déconseillé de travailler avec une version < 8.0"));
|
||||
echo '</p>';
|
||||
} else {
|
||||
echo $g_succeed. " Version PHP ".phpversion();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -87,6 +87,69 @@ function activate_checkbox_range(p_range_name) {
|
|||
checkbox_set_range(event, elt, p_range_name);
|
||||
},false));
|
||||
}
|
||||
;
|
||||
|
||||
/**
|
||||
* Checkbox for Debit - Credit , from Misc Operation
|
||||
*/
|
||||
function activate_checkbox_side()
|
||||
{
|
||||
var aCheckBox=$$('.debit-credit')
|
||||
aCheckBox.forEach((item)=>item.addEventListener('click',function (event) {
|
||||
display_range_dcside(event,item);
|
||||
display_dcside(item);
|
||||
}
|
||||
));
|
||||
aCheckBox.forEach((item)=>display_dcside(item))
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the range of checkbox in Misc Operation
|
||||
* @see Acc_Ledger::input
|
||||
* @param item checkbox to change
|
||||
* @param event event
|
||||
*/
|
||||
function display_range_dcside(evt,item)
|
||||
{
|
||||
if (!evt.shiftKey) {
|
||||
lastcheck = item;
|
||||
return;
|
||||
}
|
||||
var p_name='debit-credit'
|
||||
var aName = document.getElementsByClassName(p_name);
|
||||
|
||||
var from = 0;
|
||||
var end = 0;
|
||||
for (var i = 0; i < aName.length; i++) {
|
||||
if (aName[i] == item) {
|
||||
endcheck = aName[i];
|
||||
from = i;
|
||||
}
|
||||
if (aName[i] == lastcheck) {
|
||||
end = i;
|
||||
}
|
||||
}
|
||||
if (from > end) {
|
||||
let a = from;
|
||||
from = end;
|
||||
end = a;
|
||||
}
|
||||
var check = (aName[from].checked) ? true : false;
|
||||
for (x = from; x <= end; x++) {
|
||||
aName[x].checked = check;
|
||||
display_dcside(aName[x]);
|
||||
}
|
||||
checkTotalDirect()
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the SPAN for the range , id based on checkbox id (txtck0), if checked , display Debit otherwise Credit
|
||||
* @param item
|
||||
*/
|
||||
function display_dcside(item)
|
||||
{
|
||||
if (item.checked == true) {
|
||||
$('txt'+item.id).update("Débit")
|
||||
} else {
|
||||
$('txt'+item.id).update("Crédit")
|
||||
}
|
||||
}
|
||||
|
|
@ -1570,7 +1570,7 @@ class Securimage_Color {
|
|||
* @param $green Green component 0-255
|
||||
* @param $blue Blue component 0-255
|
||||
*/
|
||||
function Securimage_Color($red, $green = null, $blue = null)
|
||||
function __construct($red, $green = null, $blue = null)
|
||||
{
|
||||
if ($green == null && $blue == null && preg_match('/^#[a-f0-9]{3,6}$/i', $red)) {
|
||||
$col = substr($red, 1);
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ if ( $action == "info" && SYSINFO_DISPLAY == true) {
|
|||
echo phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_ENVIRONMENT | INFO_VARIABLES);
|
||||
$r=ob_get_clean();
|
||||
$html=new DOMDocument();
|
||||
libxml_use_internal_errors(true);
|
||||
$html->loadHTML($r);
|
||||
$nodelist=$html->getElementsByTagName("style");
|
||||
$nodelist->item(0)->nodeValue='
|
||||
|
|
|
|||
247
include/ajax/ajax_operation_exercice.php
Normal file
247
include/ajax/ajax_operation_exercice.php
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
<?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 6/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief display the possible value of exercice
|
||||
*/
|
||||
global $http, $g_user;
|
||||
if ($g_user->check_module("OPCL") == 0) throw new \Exception(EXC_FORBIDDEN);
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Update the periode of the selected folder
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+update_periode") {
|
||||
|
||||
try {
|
||||
$folder_id = $http->get("folder", "number");
|
||||
if ($g_user->check_dossier($folder_id, true) == 'X') throw new \Exception(EXC_FORBIDDEN);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$conx = new Database($folder_id);
|
||||
$periode = $conx->make_array("select distinct p_exercice,p_exercice from parm_periode order by p_exercice desc");
|
||||
$sExercice = new ISelect("exercice");
|
||||
$sExercice->id = "select_exercice_id";
|
||||
$sExercice->value = $periode;
|
||||
echo $sExercice->input();
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Display a detail operation_exercice to modify or add id
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+modify_row") {
|
||||
try {
|
||||
$row_id = $http->post("row_id", "number", -1);
|
||||
$oe_id = $http->post("oe_id", "number");
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
|
||||
$operation_detail_sql->oe_id = $oe_id;
|
||||
if ($row_id == -1) $operation_detail_sql->oed_debit = 'f';
|
||||
Operation_Exercice::input_row($operation_detail_sql);
|
||||
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// save a row
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+save_row") {
|
||||
try {
|
||||
$row_id = $http->post("row_id", "number");
|
||||
$oe_id = $http->post("oe_id", "number");
|
||||
$oe_poste = $http->post("oe_poste", "text");
|
||||
$qcode = $http->post("qcode", "text");
|
||||
$label = $http->post("label", "text");
|
||||
$amount = $http->post("amount", "number");
|
||||
$debit = $http->post("debit", "text", 'f');
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
|
||||
|
||||
$operation_detail_sql->setp("oed_poste", $oe_poste)
|
||||
->setp("oed_qcode", $qcode)
|
||||
->setp("oed_label", $label)
|
||||
->setp("oed_amount", $amount)
|
||||
->setp("oe_id", $oe_id)
|
||||
->setp("oed_debit", $debit);
|
||||
try {
|
||||
$operation_detail_sql->save();
|
||||
$data = $operation_detail_sql->to_array();
|
||||
|
||||
ob_start();
|
||||
$operation_exercice = new Operation_Exercice();
|
||||
if ($row_id == -1) {
|
||||
$operation_exercice->display_row($data, true);
|
||||
} else {
|
||||
|
||||
$operation_exercice->display_row($data, false);
|
||||
}
|
||||
$str = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$answer = [];
|
||||
$answer["status"] = "OK";
|
||||
$answer['row_id'] = $operation_detail_sql->oed_id;
|
||||
$answer['oe_id'] = $operation_detail_sql->oe_id;
|
||||
$answer['content'] = $str;
|
||||
echo json_response($answer);
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Compute the balance, we receive only the OED_ID , then we must find out what was the complete
|
||||
// OPERATION_EXERCICE
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+display_total") {
|
||||
try {
|
||||
$row_id = $http->get("row_id", "number");
|
||||
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
|
||||
if ($operation_detail_sql->getp("oe_id") == "") {
|
||||
throw new Exception("AOE-113:not existing line");
|
||||
}
|
||||
$operation_exercice = new Operation_Exercice($operation_detail_sql->oe_id);
|
||||
$operation_exercice->display_total(false);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
//delete a row OPERATION_EXERCICE
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+delete_row") {
|
||||
try {
|
||||
$row_id = $http->get("row_id", "number");
|
||||
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
|
||||
$oe_id = $operation_detail_sql->oe_id;
|
||||
$other_row = $cn->get_value("select oed_id from operation_exercice_detail where oe_id=$1 limit 1 ",
|
||||
[$oe_id]);
|
||||
|
||||
$operation_detail_sql->delete();
|
||||
echo json_response(array("status" => "OK", "row_id" => $other_row));
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Change the date
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+date") {
|
||||
try {
|
||||
$oe_id = $http->request("oe_id", "number");
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
$input = $http->request("input");
|
||||
$action = $http->request("ieaction", "string", "display");
|
||||
$ajax_date = Inplace_Edit::build($input);
|
||||
$ajax_date->add_json_param("op", "operation_exercice+date");
|
||||
$ajax_date->add_json_param("gDossier", Dossier::id());
|
||||
$ajax_date->add_json_param("oe_id", $oe_id);
|
||||
$ajax_date->set_callback("ajax_misc.php");
|
||||
|
||||
if ($action == "display") {
|
||||
|
||||
echo $ajax_date->ajax_input();
|
||||
}
|
||||
if ($action == "ok") {
|
||||
$value = $http->request("value");
|
||||
$cn->exec_sql("update operation_exercice set oe_date=to_date($1,'DD.MM.YYYY') where oe_id=$2", [$value, $oe_id]);
|
||||
$ajax_date->set_value($value);
|
||||
echo $ajax_date->value();
|
||||
}
|
||||
if ($action == "cancel") {
|
||||
|
||||
echo $ajax_date->value();
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Change the text
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+text") {
|
||||
try {
|
||||
$oe_id = $http->request("oe_id", "number");
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
$input = $http->request("input");
|
||||
$action = $http->request("ieaction", "string", "display");
|
||||
$ajax_text = Inplace_Edit::build($input);
|
||||
$ajax_text->add_json_param("op", "operation_exercice+text");
|
||||
$ajax_text->add_json_param("gDossier", Dossier::id());
|
||||
$ajax_text->add_json_param("oe_id", $oe_id);
|
||||
$ajax_text->set_callback("ajax_misc.php");
|
||||
|
||||
if ($action == "display") {
|
||||
|
||||
echo $ajax_text->ajax_input();
|
||||
}
|
||||
if ($action == "ok") {
|
||||
$value = $http->request("value");
|
||||
$cn->exec_sql("update operation_exercice set oe_text=$1 where oe_id=$2", [$value, $oe_id]);
|
||||
$ajax_text->set_value($value);
|
||||
echo $ajax_text->value();
|
||||
}
|
||||
if ($action == "cancel") {
|
||||
|
||||
echo $ajax_text->value();
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Check and transfer to accountancy if OK
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ($op == "operation_exercice+transfer") {
|
||||
try {
|
||||
$operation_exercice_id = $http->request("oe_id", "number");
|
||||
$ledger_id = $http->request('p_jrn', "number");
|
||||
if ($g_user->check_jrn($ledger_id) == "X") throw new \Exception (EXC_FORBIDDEN);
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
// first , check that everything is ok
|
||||
$operation_exercice = new Operation_Exercice($operation_exercice_id);
|
||||
|
||||
global $oe_result, $oe_status;
|
||||
$answer = array();
|
||||
$operation_exercice->submit_transfer($ledger_id);
|
||||
$answer['status'] = $oe_status;
|
||||
if ($answer['status'] == 'NOK') {
|
||||
$answer['content'] = span($oe_result, 'class=warning');
|
||||
}else {
|
||||
$answer['content'] = span($oe_result);
|
||||
|
||||
}
|
||||
echo json_response($answer);
|
||||
return;
|
||||
}
|
||||
|
|
@ -73,6 +73,7 @@ if ( isset ($_REQUEST['sa']) )
|
|||
$database=domaine."dossier".$dossier_number;
|
||||
$filename= str_replace(array('/','\\' ,'<','>','"','[',']',':','*',' ','{','}','&'),'_', $name);
|
||||
$filename= str_replace("__", "_", $filename);
|
||||
$filename=str_replace(PHP_EOL,'',$filename);
|
||||
$filename.="-".date('Ymd');
|
||||
$args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database;
|
||||
header('Content-type: application/octet');
|
||||
|
|
@ -90,6 +91,7 @@ if ( isset ($_REQUEST['sa']) )
|
|||
$database=domaine."mod".$dossier_number;
|
||||
$filename= str_replace(array('/','\\' ,'<','>','"','[',']',':','*',' ','{','}','&'),'_', $name);
|
||||
$filename= str_replace("__", "_", $filename);
|
||||
$filename=str_replace(PHP_EOL,'',$filename);
|
||||
$filename.="-".date('Ymd');
|
||||
$args= " -Fc -Z9 --no-owner -h ".getenv("PGHOST")." -p ".getenv("PGPORT")." ".$database;
|
||||
header('Content-type: bin/x-application');
|
||||
|
|
|
|||
|
|
@ -472,6 +472,7 @@ if ( isset($_GET['view'] ) )
|
|||
|
||||
}
|
||||
echo '</table>';
|
||||
if ( DEBUGNOALYSS>1) echo \Noalyss\Dbg::hidden_info("\$row", $row);
|
||||
// display the summary
|
||||
if ($is_summary==1) {
|
||||
if ( $previous == 1) {
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ class Acc_Balance
|
|||
$side_delta=findSide($delta);
|
||||
|
||||
$a['poste']="";
|
||||
$a['label']=sprintf(_("Totaux %s %s"),nbm(abs($delta)),$side_delta);
|
||||
$a['label']=sprintf(_("Totaux delta %s %s"),nbm(abs($delta)),$side_delta);
|
||||
$a['sum_deb']=$tot_deb;
|
||||
$a['sum_cred']=$tot_cred;
|
||||
$a['solde_deb']=$tot_deb_saldo;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
}
|
||||
/**
|
||||
* @brief Return the type of a ledger (ACH,VEN,ODS or FIN) or GL
|
||||
*
|
||||
* @return string FIN ODS ACH VEN or GL if id == 0
|
||||
*/
|
||||
function get_type()
|
||||
{
|
||||
|
|
@ -995,7 +995,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
'<th style="text-align:left">'._('Poste').$info_poste.'</th>'.
|
||||
'<th class="visible_gt800 visible_gt1155" style="text-align:left">'._('Libellé').'</th>'.
|
||||
'<th style="text-align:left">'._('Montant').'</th>'.
|
||||
'<th style="text-align:left">'._('Débit').'</th>'.
|
||||
'<th style="text-align:left">'._('Côté').'</th>'.
|
||||
'</tr>';
|
||||
|
||||
|
||||
|
|
@ -1065,13 +1065,13 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$amount->value=(isset(${'amount'.$i}))?${"amount".$i}:''
|
||||
;
|
||||
$amount->readonly=$p_readonly;
|
||||
$amount->javascript=' onChange="format_number(this);checkTotalDirect()"';
|
||||
$amount->javascript='onChange="format_number(this);checkTotalDirect()"';
|
||||
// D/C
|
||||
$deb=new ICheckBox();
|
||||
$deb->name='ck'.$i;
|
||||
$deb->selected=(isset(${'ck'.$i}))?true:false;
|
||||
$deb->readonly=$p_readonly;
|
||||
$deb->javascript=' onChange="checkTotalDirect()"';
|
||||
$deb->javascript='class="debit-credit" onChange="checkTotalDirect()"';
|
||||
$str_add_button=($add_card==true)?$this->add_card("-1",
|
||||
$quick_code->id):"";
|
||||
$ret.='<tr>';
|
||||
|
|
@ -1085,7 +1085,9 @@ class Acc_Ledger extends jrn_def_sql
|
|||
'</td>';
|
||||
$ret.='<td class="visible_gt800 visible_gt1155">'.$line_desc->input().'</td>';
|
||||
$ret.='<td>'.$amount->input().'</td>';
|
||||
$ret.='<td>'.$deb->input().'</td>';
|
||||
$ret.='<td>'.$deb->input()
|
||||
.'<span id="txt'.$deb->id.'"></span>'
|
||||
.'</td>';
|
||||
$ret.='</tr>';
|
||||
// If readonly == 1 then show CA
|
||||
}
|
||||
|
|
@ -1099,6 +1101,9 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$ret.=sprintf(_("Réconciliation/rapprochements : %s"), $w->input());
|
||||
}
|
||||
$ret.=create_script("$('".$wDate->id."').focus()");
|
||||
// for displaying Credit or Debit
|
||||
$ret.=create_script("(function(){activate_checkbox_side()})();");
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
@ -1754,34 +1759,6 @@ class Acc_Ledger extends jrn_def_sql
|
|||
return $card;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the saldo of an exercice, used for the opening of a folder
|
||||
* @param$p_exercice is the exercice we want
|
||||
* \return an array
|
||||
* index =
|
||||
* - solde (debit > 0 ; credit < 0)
|
||||
* - j_poste
|
||||
* - j_qcode
|
||||
*/
|
||||
function get_saldo_exercice($p_exercice)
|
||||
{
|
||||
$sql="select sum(a.montant) as solde, j_poste, j_qcode
|
||||
from
|
||||
(select j_id, case when j_debit='t' then j_montant
|
||||
else j_montant * (-1) end as montant
|
||||
from jrnx) as a
|
||||
join jrnx using (j_id)
|
||||
join parm_periode on (j_tech_per = p_id )
|
||||
where
|
||||
p_exercice=$1
|
||||
and j_poste::text not like '7%'
|
||||
and j_poste::text not like '6%'
|
||||
group by j_poste,j_qcode
|
||||
having (sum(a.montant) != 0 ) order by 1 desc";
|
||||
$res=$this->db->get_array($sql, array($p_exercice));
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if a Dossier is using the strict mode or not
|
||||
* \return true if we are using the strict_mode
|
||||
|
|
@ -1943,7 +1920,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
$empl->get_by_qcode($e_mp_qcode);
|
||||
if ($empl->empty_attribute(ATTR_DEF_ACCOUNT)==true)
|
||||
{
|
||||
throw new Exception(_("Celui qui paie n' a pas de poste comptable"),
|
||||
throw new Exception(_("Le moyen de paiement choisi n'a pas de poste comptable"),
|
||||
20);
|
||||
}
|
||||
/* get the account and explode if necessary */
|
||||
|
|
|
|||
|
|
@ -654,7 +654,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
td(_("Ancien solde")).
|
||||
td(nbm($solde).$cur, 'class="num"')
|
||||
);
|
||||
$new_solde=bcadd($solde, $tot_amount);
|
||||
$new_solde=bcadd($solde??0, $tot_amount??0);
|
||||
$r.=tr(
|
||||
td(_("Nouveau solde")).
|
||||
td(nbm($new_solde).$cur, ' class="num"')
|
||||
|
|
@ -1136,11 +1136,12 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
}
|
||||
|
||||
/**
|
||||
* return the fiche_id of the bank
|
||||
* @brief find and FICHE.F_ID of the bank or -1 if not found
|
||||
*/
|
||||
function get_bank()
|
||||
{
|
||||
$bank_id=$this->db->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1', array($this->id));
|
||||
if (empty($bank_id)) return -1;
|
||||
return $bank_id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -700,7 +700,9 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History
|
|||
public function export_oneline_html()
|
||||
{
|
||||
$this->get_rowSimple();
|
||||
echo '<TABLE class="result">';
|
||||
|
||||
echo \HtmlInput::filter_table("tb_print_ledger", "0,1,2,3,4,5,6", 1);
|
||||
echo '<TABLE class="result" id="tb_print_ledger">';
|
||||
echo "<TR>".
|
||||
th(_("Date")).
|
||||
th(_("n° pièce")).
|
||||
|
|
|
|||
|
|
@ -950,20 +950,22 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$mp=new Acc_Payment($this->db,$e_mp);
|
||||
$mp->load();
|
||||
|
||||
/* fiche */
|
||||
if ($mp->get_parameter('qcode') == '')
|
||||
$fqcode=${'e_mp_qcode_'.$e_mp};
|
||||
else
|
||||
$fqcode=$mp->get_parameter('qcode');
|
||||
|
||||
$acfiche = new Fiche($this->db);
|
||||
$acfiche->get_by_qcode($fqcode);
|
||||
|
||||
/* jrnx */
|
||||
$acseq=$this->db->get_next_seq('s_grpt');
|
||||
$acjrn=new Acc_Ledger($this->db,$mp->get_parameter('ledger_target'));
|
||||
$acinternal=$acjrn->compute_internal_code($acseq);
|
||||
|
||||
/*
|
||||
* for the use of the card of the bank
|
||||
*/
|
||||
if ( $acjrn->get_type()=='FIN') {
|
||||
$acjrn=new Acc_Ledger_Fin($this->db, $mp->get_parameter('ledger_target'));
|
||||
$acfiche=new Fiche($this->db,$acjrn->get_bank());
|
||||
$fqcode=$acfiche->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
} else {
|
||||
$fqcode = ${'e_mp_qcode_' . $e_mp};
|
||||
$acfiche = new Fiche($this->db);
|
||||
$acfiche->get_by_qcode($fqcode);
|
||||
}
|
||||
/* Insert paid by */
|
||||
$acc_pay=new Acc_Operation($this->db);
|
||||
$acc_pay->date=$e_date;
|
||||
|
|
@ -2141,6 +2143,7 @@ EOF;
|
|||
return $array;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -242,9 +242,13 @@ class Acc_Ledger_Sale extends Acc_Ledger {
|
|||
$this->check_currency_setting($p_currency_code);
|
||||
}
|
||||
|
||||
/*!\brief insert into the database, it calls first the verify function,
|
||||
* change the value of this->jr_id and this->jr_internal
|
||||
* * It generates the document if gen_invoice is set and save the middle of payment if any ($e_mp)
|
||||
/*!
|
||||
* \brief insert into the database, it calls first the verify function,
|
||||
* store the value of the inserted operation in $this->jr_id and this->jr_internal
|
||||
*
|
||||
* It generates the document if gen_invoice is set and save the middle of payment if any ($e_mp)
|
||||
*
|
||||
* It also create a second operation if there is a payment
|
||||
*
|
||||
* \param $p_array is usually $_POST or a predefined operation
|
||||
* \return string : internal number
|
||||
|
|
@ -653,16 +657,25 @@ class Acc_Ledger_Sale extends Acc_Ledger {
|
|||
$mp = new Acc_Payment($this->db, $e_mp);
|
||||
$mp->load();
|
||||
|
||||
/* fiche */
|
||||
$fqcode = ${'e_mp_qcode_' . $e_mp};
|
||||
$acfiche = new Fiche($this->db);
|
||||
$acfiche->get_by_qcode($fqcode);
|
||||
|
||||
/* jrnx */
|
||||
$acseq = $this->db->get_next_seq('s_grpt');
|
||||
$acjrn = new Acc_Ledger($this->db, $mp->get_parameter('ledger_target'));
|
||||
$acinternal = $acjrn->compute_internal_code($acseq);
|
||||
|
||||
/*
|
||||
* for the use of the card of the bank
|
||||
*/
|
||||
if ( $acjrn->get_type()=='FIN') {
|
||||
$acjrn=new Acc_Ledger_Fin($this->db, $mp->get_parameter('ledger_target'));
|
||||
$acfiche=new Fiche($this->db,$acjrn->get_bank());
|
||||
$fqcode=$acfiche->strAttribut(ATTR_DEF_QUICKCODE);
|
||||
} else {
|
||||
$fqcode = ${'e_mp_qcode_' . $e_mp};
|
||||
$acfiche = new Fiche($this->db);
|
||||
$acfiche->get_by_qcode($fqcode);
|
||||
}
|
||||
|
||||
/* Insert paid by */
|
||||
$acc_pay = new Acc_Operation($this->db);
|
||||
$acc_pay->date = $pay_date;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class Calendar
|
|||
var $str_name; // array of tiers for event - follow-up (T: action_gestion)
|
||||
var $title; // array of title for each event - follow-up (T: action_gestion)
|
||||
var $hour ; // array of hour for each event - follow-up (T: action_gestion)
|
||||
var $default_periode; //default periode
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
|
@ -257,7 +258,7 @@ class Calendar
|
|||
{
|
||||
$p_id=$g_user->get_periode();
|
||||
}
|
||||
$this->default_periode=$p_id;
|
||||
$this->default_periode=$p_id;
|
||||
return $p_id;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class Document_Export
|
|||
* @param int $reconcilied_operation 1 with receipt of reconcilied operation 2 without them
|
||||
*
|
||||
*/
|
||||
function export_all($p_array, Progress_Bar $progress,$p_separate=1,$reconcilied_document)
|
||||
function export_all($p_array, Progress_Bar $progress,$p_separate=1,$reconcilied_document=2)
|
||||
{
|
||||
$this->progress=$this->progress;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,12 @@ class Dossier
|
|||
"desc"=>"dos_description",
|
||||
"max_email"=>'dos_email');
|
||||
|
||||
var $cn; //!< Database connexion
|
||||
var $dos_id; //!< number of db
|
||||
var $dos_name;
|
||||
var $dos_description;
|
||||
var $dos_email;
|
||||
|
||||
function __construct($p_id)
|
||||
{
|
||||
$this->cn=new Database(); // Connect to the repository
|
||||
|
|
|
|||
|
|
@ -190,7 +190,8 @@ EOF;
|
|||
where
|
||||
apo2.contact_option_ref_id =$1
|
||||
and ap.f_id=$2
|
||||
", array($pa_Column[$i]['cor_id'], $p_fid));
|
||||
and ap.ag_id=$3
|
||||
", array($pa_Column[$i]['cor_id'], $p_fid, $this->ag_id));
|
||||
$r.=td($value);
|
||||
}
|
||||
$r.='<td>'.$remove.'</td>';
|
||||
|
|
|
|||
126
include/class/operation_closing.class.php
Normal file
126
include/class/operation_closing.class.php
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
<?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 6/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief
|
||||
*/
|
||||
class Operation_Closing extends Operation_Exercice
|
||||
{
|
||||
private $signature ;
|
||||
private $exercice;
|
||||
|
||||
function __construct($p_id)
|
||||
{
|
||||
parent::__construct($p_id);
|
||||
$this->signature='closing';
|
||||
|
||||
}
|
||||
public function get_exercice()
|
||||
{
|
||||
return $this->exercice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $exercice
|
||||
*/
|
||||
public function set_exercice($exercice): void
|
||||
{
|
||||
$this->exercice = $exercice;
|
||||
}
|
||||
public function get_signature(): string
|
||||
{
|
||||
return $this->signature;
|
||||
}
|
||||
|
||||
function from_request()
|
||||
{
|
||||
$http = new HttpInput();
|
||||
$this->exercice = $http->request("exercice_cl", "number");
|
||||
}
|
||||
/**
|
||||
* @brief insert data into data operation_exercice and operation_exercice_detail
|
||||
* @return void
|
||||
*/
|
||||
function insert()
|
||||
{
|
||||
$cn = Dossier::connect();
|
||||
|
||||
$sql = "
|
||||
with total_account as (
|
||||
select sum(a.montant) as tot_amount, j_poste, f_id
|
||||
from
|
||||
(select j_id, case when j_debit='t' then j_montant
|
||||
else j_montant * (-1) end as montant
|
||||
from jrnx) as a
|
||||
join jrnx using (j_id)
|
||||
join parm_periode on (j_tech_per = p_id )
|
||||
where
|
||||
p_exercice=$1
|
||||
and( j_poste::text like '7%'
|
||||
or j_poste::text like '6%')
|
||||
group by j_poste,f_id
|
||||
having (sum(a.montant) != 0 )
|
||||
)
|
||||
select t1.tot_amount
|
||||
,t1.j_poste
|
||||
,(select pcm_lib from tmp_pcmn where pcm_val=t1.j_poste) as lib_accounting
|
||||
,t1.f_id
|
||||
,(select ad_value fd2 from fiche_detail fd2 where fd2.f_id=t1.f_id and fd2.ad_id=23) qcode
|
||||
,(select fd3.ad_value from fiche_detail fd3 where fd3.f_id=t1.f_id and fd3.ad_id=1) f_name
|
||||
,abs(t1.tot_amount) atot_amount
|
||||
,case when tot_amount <0 then 'f' else 't' end debit
|
||||
from total_account t1
|
||||
";
|
||||
$exercice_report=$this->exercice;
|
||||
$this->operation_exercice_sql->setp("oe_type", $this->signature)
|
||||
->setp("oe_dossier_id", Dossier::id())
|
||||
->set("oe_text",_("Ecriture cloture $exercice_report"))
|
||||
->setp("oe_exercice", $this->exercice);
|
||||
try {
|
||||
$cn->start();
|
||||
$this->operation_exercice_sql->insert();
|
||||
$array = $cn->get_array($sql, array($this->exercice));
|
||||
if (empty($array)) return;
|
||||
foreach ($array as $item) {
|
||||
$row = new Operation_Exercice_Detail_SQL($cn);
|
||||
$row->oe_id = $this->operation_exercice_sql->oe_id;
|
||||
$row->oed_poste = (empty($item['qcode']))?$item["j_poste"]:null;
|
||||
$row->oed_qcode = $item["qcode"];
|
||||
$row->oed_amount = $item['atot_amount'];
|
||||
$row->oed_label=(empty($item['qcode']))?$item['lib_accounting']:$item['f_name'];
|
||||
$row->oed_debit = $item["debit"];
|
||||
$row->save();
|
||||
}
|
||||
$cn->commit();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$cn->rollback();
|
||||
echo $e->getMessage();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
}
|
||||
public function display_result()
|
||||
{
|
||||
echo h2("Clôture compte");
|
||||
|
||||
parent::display_result(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
}
|
||||
311
include/class/operation_exercice.class.php
Normal file
311
include/class/operation_exercice.class.php
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
<?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 6/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief
|
||||
*/
|
||||
|
||||
class Operation_Exercice
|
||||
{
|
||||
protected $operation_exercice_sql;
|
||||
|
||||
|
||||
public function __construct($p_id = -1)
|
||||
{
|
||||
$this->operation_exercice_sql = new Operation_Exercice_SQL(Dossier::connect(), $p_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief input the source of the data : folder, exercice, closing or opening operation
|
||||
* @return void
|
||||
*/
|
||||
public static function input_source()
|
||||
{
|
||||
require NOALYSS_TEMPLATE . "/operation_exercice-input_source.php";
|
||||
}
|
||||
|
||||
function display_result()
|
||||
{
|
||||
$date = new IDate("exercice_date");
|
||||
$date->id = "exercice_date";
|
||||
$date->value = format_date($this->operation_exercice_sql->getp("oe_date"), "DD.MM.YYYY");
|
||||
$inplace_date = new Inplace_Edit($date);
|
||||
$inplace_date->add_json_param("op", "operation_exercice+date");
|
||||
$inplace_date->add_json_param("gDossier", Dossier::id());
|
||||
$inplace_date->add_json_param("oe_id", $this->operation_exercice_sql->oe_id);
|
||||
$inplace_date->set_callback("ajax_misc.php");
|
||||
echo _("Date"), $inplace_date->input();
|
||||
|
||||
$text_operation = new IText("text_operation");
|
||||
$text_operation->id = uniqid("text");
|
||||
$text_operation->size = 80;
|
||||
$text_operation->value = $this->operation_exercice_sql->getp("oe_text");
|
||||
$inplace_text = new Inplace_Edit($text_operation);
|
||||
$inplace_text->add_json_param("op", "operation_exercice+text");
|
||||
$inplace_text->add_json_param("gDossier", Dossier::id());
|
||||
$inplace_text->add_json_param("oe_id", $this->operation_exercice_sql->oe_id);
|
||||
$inplace_text->set_callback("ajax_misc.php");
|
||||
echo $inplace_text->input();
|
||||
|
||||
$cn = Dossier::connect();
|
||||
// get data
|
||||
$a_data = $cn->get_array("
|
||||
SELECT oed_id
|
||||
, oe_id
|
||||
, oed_poste
|
||||
, oed_qcode
|
||||
, oed_label
|
||||
, oed_amount
|
||||
, oed_debit
|
||||
FROM public.operation_exercice_detail
|
||||
where
|
||||
oe_id=$1
|
||||
order by oed_debit desc,oed_poste,oed_qcode
|
||||
|
||||
", [$this->operation_exercice_sql->oe_id]);
|
||||
$aheader = array(_("Poste"), _("Fiche"), _("Libellé"), _("Montant"), _("Débit/Crédit"));
|
||||
echo '<div></div>';
|
||||
echo \HtmlInput::filter_table("operation_exercice_tb", '0,1,2,3,4', 1);
|
||||
echo \HtmlInput::button_action(_("Ajouter une ligne"), sprintf("operation_exercice.modify_row('-1','%s')", $this->operation_exercice_sql->oe_id));
|
||||
echo '<table class="result" id="operation_exercice_tb">';
|
||||
foreach ($aheader as $header) echo th($header, 'style="text-align:center"');
|
||||
echo th("");
|
||||
|
||||
foreach ($a_data as $data) {
|
||||
$this->display_row($data);
|
||||
}
|
||||
echo '</table>';
|
||||
echo \HtmlInput::button_action(_("Ajouter une ligne"), sprintf("operation_exercice.modify_row('-1','%s')", $this->operation_exercice_sql->oe_id));
|
||||
$this->display_total();
|
||||
echo Dossier::hidden();
|
||||
$js = <<<EOF
|
||||
(function() {
|
||||
$$(".op-exercice").forEach(item=>item.addEventListener("click",function(event) {operation_exercice.click_modify_row(item)}));
|
||||
})();
|
||||
EOF;
|
||||
echo create_script($js);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief display the balance (total) of the operation
|
||||
* @param bool $with_span if yes add the span wrapper , otherwise doesn't add it
|
||||
*/
|
||||
public function display_total($with_span = true)
|
||||
{
|
||||
$cn = Dossier::connect();
|
||||
$sql_total = "
|
||||
with saldo_deb_cred as
|
||||
(
|
||||
select
|
||||
case when oed_debit is true then oed_amount else 0-oed_amount end signed_amount ,
|
||||
case when oed_debit is true then oed_amount end debit,
|
||||
case when oed_debit is false then oed_amount end credit
|
||||
from public.operation_exercice_detail
|
||||
where oe_id=$1
|
||||
)
|
||||
select sum(signed_amount) delta,sum(debit) debit,sum(credit) credit from saldo_deb_cred
|
||||
";
|
||||
$total = $cn->get_row($sql_total, [$this->operation_exercice_sql->oe_id]);
|
||||
if ($with_span) {
|
||||
echo '<span id="tot_ope_exe" style="margin-left:20%">';
|
||||
}
|
||||
$style = 'style="display:inline-block;padding:1rem;margin:1rem;border:1px solid navy;width:20%;text-align:center;font-size:140%"';
|
||||
|
||||
echo span(sprintf(_("Débit %s"), nbm($total['debit'])), $style);
|
||||
echo span(sprintf(_("Crédit %s"), nbm($total['credit'])), $style);
|
||||
$s = "";
|
||||
if ($total['delta'] > 0) {
|
||||
$s = " Solde débiteur ";
|
||||
}
|
||||
if ($total['delta'] < 0) {
|
||||
$s = " Solde créditeur ";
|
||||
}
|
||||
echo span($s . " " . nbm($total['delta']), $style);
|
||||
if ($with_span) {
|
||||
echo '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief let display one row
|
||||
* @param $data array row of operation_exercice_detail [oed_id, oe_id, oed_poste, oed_qcode oed_label
|
||||
* oed_amount oed_debit]
|
||||
* @return void
|
||||
* @see Operation_Exercice_Detail_SQL
|
||||
*/
|
||||
function display_row($data, $row_tr = true)
|
||||
{
|
||||
if ($row_tr) printf('<tr class="op-exercice even" id="oe_%s" oed_id="%s" oe_id="%s">', $data['oed_id'], $data['oed_id'], $data['oe_id']);
|
||||
echo td($data['oed_poste']);
|
||||
echo td($data['oed_qcode']);
|
||||
echo td(h($data['oed_label']));
|
||||
echo td(nbm($data['oed_amount']), 'class="num"');
|
||||
echo td(($data['oed_debit'] == 'f' ? _("Crédit") : _("Débit")), 'style="text-align:center"');
|
||||
echo td(\Icon_Action::modify(uniqid(), sprintf("operation_exercice.modify_row('%s','%s')", $data['oed_id'], $data['oe_id'])));
|
||||
|
||||
|
||||
if ($row_tr) print ('</tr >');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief input one row of operation_exercice
|
||||
* @param $data array row of operation_exercice_detail [oed_id, oe_id, oed_poste, oed_qcode oed_label
|
||||
* oed_amount oed_debit]
|
||||
* @return void
|
||||
* @see Operation_Exercice_Detail_SQL
|
||||
*/
|
||||
public static function input_row(Operation_Exercice_Detail_SQL $operation_detail_sql)
|
||||
{
|
||||
$operation=new Operation_Exercice_SQL($operation_detail_sql->get_cn(),$operation_detail_sql->getp("oe_id"));
|
||||
if ( $operation->getp("oe_transfer_date") !="") {
|
||||
require_once NOALYSS_TEMPLATE . "/operation_exercice-input_row-error.php";
|
||||
return;
|
||||
}
|
||||
|
||||
require_once NOALYSS_TEMPLATE . "/operation_exercice-input_row.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief input data for transfering
|
||||
* @return void
|
||||
*/
|
||||
function input_transfer()
|
||||
{
|
||||
$operation=$this->operation_exercice_sql;
|
||||
if ( $operation->getp("oe_transfer_date") !="") {
|
||||
echo '<span class="warning">';
|
||||
printf(_("Opération transférée le %s")
|
||||
,$operation->getp("oe_transfer_date") );
|
||||
echo '</span>';
|
||||
return;
|
||||
}
|
||||
require_once NOALYSS_TEMPLATE . "/operation_exercice-input_transfer.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief transfer to accountancy
|
||||
* @param $ledger_id int the ledger id (jrn_def_id)
|
||||
* @return void
|
||||
*/
|
||||
function submit_transfer($ledger_id)
|
||||
{
|
||||
global $oe_result; // result of operation
|
||||
global $oe_data; // transform data to array used by Acc_Ledger::insert
|
||||
global $oe_status ; // status OK or NOK
|
||||
$cn = Dossier::connect();
|
||||
|
||||
$this->transform($ledger_id);
|
||||
|
||||
$oe_status = "OK";
|
||||
$ledger = new Acc_Ledger($cn, $ledger_id);
|
||||
try {
|
||||
$cn->start();
|
||||
if ($this->operation_exercice_sql->getp("oe_transfer_date")!="") throw new \Exception("duplicate",EXC_DUPLICATE);
|
||||
if ( empty($oe_data['e_date'] ) ) throw new \Exception ("Date null",2);
|
||||
$ledger->verify_operation($oe_data);
|
||||
$ledger->save($oe_data);
|
||||
$oe_result=_("Détail opération");
|
||||
$oe_result.=sprintf('<a class="detail" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a><hr>',
|
||||
$ledger->jr_id, dossier::id(), $ledger->internal);
|
||||
|
||||
$cn->exec_sql("update operation_exercice set oe_transfer_date=to_timestamp($1,'DD.MM.YY HH24:MI') , jr_internal=$2 where oe_id=$3",
|
||||
[date('d.m.Y H:i'),$ledger->internal,$this->operation_exercice_sql->oe_id]);
|
||||
|
||||
$cn->commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
$oe_result=$e->getMessage();
|
||||
|
||||
$oe_status='NOK';
|
||||
$cn->rollback();
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform the data in table OPERATION_EXERCICE and OPERATION_EXERCICE_DETAIL into an array usable
|
||||
* by Acc_Ledger, the result will be stored into the global variable $oe_data
|
||||
* @globals $oe_data array with the data transformed
|
||||
* @param $ledger_id
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
function transform($ledger_id)
|
||||
{
|
||||
global $oe_data; // transform data to array used by Acc_Ledger::verify_operation
|
||||
$cn = Dossier::connect();
|
||||
$acc_ledger=new \Acc_Ledger($cn, $ledger_id);
|
||||
$oe_data = array();
|
||||
$oe_data['p_currency_code'] = 0;
|
||||
$oe_data['p_currency_rate'] = 1;
|
||||
$oe_data['p_jrn'] = $ledger_id;
|
||||
$oe_data['e_date'] = $this->operation_exercice_sql->oe_date;
|
||||
$oe_data['desc']=$this->operation_exercice_sql->getp("oe_text");
|
||||
$operation_detail_sql = new Operation_Exercice_Detail_SQL($cn);
|
||||
$all_operation = $operation_detail_sql->collect_objects(' where oe_id = $1',[$this->operation_exercice_sql->oe_id]);
|
||||
$nb = 0;
|
||||
foreach ($all_operation as $item) {
|
||||
$oe_data['qc_' . $nb] = $item->oed_qcode;
|
||||
$oe_data['poste' . $nb] = $item->oed_poste;
|
||||
$oe_data['ld' . $nb] = $item->oed_label;
|
||||
$oe_data['amount' . $nb] = $item->oed_amount;
|
||||
|
||||
if ($item->oed_debit == "t") $oe_data['ck' . $nb] = 't';
|
||||
$nb++;
|
||||
}
|
||||
$oe_data['nb_item']=$nb;
|
||||
$oe_data['e_pj']=$acc_ledger->guess_pj();
|
||||
$oe_data['e_pj_suggest']=$acc_ledger->guess_pj();
|
||||
$oe_data['mt']=microtime(true);
|
||||
$oe_data['jr_optype']=($this->operation_exercice_sql->getp('oe_type')=='opening')?'OPE':'CLO';
|
||||
|
||||
}
|
||||
|
||||
public static function list_draft()
|
||||
{
|
||||
|
||||
require_once NOALYSS_TEMPLATE."/operation_exercice-list_draft.php";
|
||||
|
||||
}
|
||||
|
||||
public static function delete($aOperation_id)
|
||||
{
|
||||
$cn=Dossier::connect();
|
||||
foreach ($aOperation_id as $operation_id)
|
||||
{
|
||||
$cn->exec_sql("delete from operation_exercice where oe_id=$1",[$operation_id]);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_operation_exercice_sql(): Operation_Exercice_SQL
|
||||
{
|
||||
return $this->operation_exercice_sql;
|
||||
}
|
||||
|
||||
public function set_operation_exercice_sql(Operation_Exercice_SQL $operation_exercice_sql): Operation_Exercice_SQL
|
||||
{
|
||||
$this->operation_exercice_sql = $operation_exercice_sql;
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
156
include/class/operation_opening.class.php
Normal file
156
include/class/operation_opening.class.php
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
<?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 6/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief Operation OUVERTURE
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @brief Operation ouverture
|
||||
*/
|
||||
class Operation_Opening extends Operation_Exercice
|
||||
{
|
||||
private $signature;
|
||||
private $from_folder;
|
||||
private $exercice;
|
||||
|
||||
function __construct($p_id)
|
||||
{
|
||||
parent::__construct($p_id);
|
||||
$this->signature = 'opening';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_from_folder()
|
||||
{
|
||||
return $this->from_folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $from_folder
|
||||
*/
|
||||
public function set_from_folder($from_folder): void
|
||||
{
|
||||
$this->from_folder = $from_folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_exercice()
|
||||
{
|
||||
return $this->exercice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $exercice
|
||||
*/
|
||||
public function set_exercice($exercice): void
|
||||
{
|
||||
$this->exercice = $exercice;
|
||||
}
|
||||
|
||||
public function get_signature(): string
|
||||
{
|
||||
return $this->signature;
|
||||
}
|
||||
|
||||
function from_request()
|
||||
{
|
||||
$http = new HttpInput();
|
||||
$this->exercice = $http->request("exercice", "number");
|
||||
$this->from_folder = $http->request("dos_id", "number");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief insert data into data operation_exercice and operation_exercice_detail
|
||||
* @return void
|
||||
*/
|
||||
function insert()
|
||||
{
|
||||
$cn = Dossier::connect();
|
||||
$other_dossier = new Database($this->from_folder);
|
||||
|
||||
$sql = "
|
||||
with total_account as (
|
||||
select sum(a.montant) as tot_amount, j_poste, f_id
|
||||
from
|
||||
(select j_id, case when j_debit='t' then j_montant
|
||||
else j_montant * (-1) end as montant
|
||||
from jrnx) as a
|
||||
join jrnx using (j_id)
|
||||
join parm_periode on (j_tech_per = p_id )
|
||||
where
|
||||
p_exercice=$1
|
||||
and j_poste::text not like '7%'
|
||||
and j_poste::text not like '6%'
|
||||
group by j_poste,f_id
|
||||
having (sum(a.montant) != 0 )
|
||||
)
|
||||
select t1.tot_amount
|
||||
,t1.j_poste
|
||||
,(select pcm_lib from tmp_pcmn where pcm_val=t1.j_poste) as lib_accounting
|
||||
,t1.f_id
|
||||
,(select ad_value fd2 from fiche_detail fd2 where fd2.f_id=t1.f_id and fd2.ad_id=23) qcode
|
||||
,(select fd3.ad_value from fiche_detail fd3 where fd3.f_id=t1.f_id and fd3.ad_id=1) f_name
|
||||
,abs(t1.tot_amount) atot_amount
|
||||
,case when tot_amount <0 then 'f' else 't' end debit
|
||||
from total_account t1
|
||||
";
|
||||
$exercice_report=$this->exercice+1;
|
||||
$this->operation_exercice_sql->setp("oe_type", $this->signature)
|
||||
->setp("oe_dossier_id", $this->from_folder)
|
||||
->set("oe_text",_("Ecriture ouverture $exercice_report"))
|
||||
->setp("oe_exercice", $this->exercice);
|
||||
try {
|
||||
$cn->start();
|
||||
$this->operation_exercice_sql->insert();
|
||||
$array = $other_dossier->get_array($sql, array($this->exercice));
|
||||
if (empty($array)) return;
|
||||
foreach ($array as $item) {
|
||||
$row = new Operation_Exercice_Detail_SQL($cn);
|
||||
$row->oe_id = $this->operation_exercice_sql->oe_id;
|
||||
$row->oed_poste = (empty($item['qcode']))?$item["j_poste"]:null;
|
||||
$row->oed_qcode = $item["qcode"];
|
||||
$row->oed_amount = $item['atot_amount'];
|
||||
$row->oed_label=(empty($item['qcode']))?$item['lib_accounting']:$item['f_name'];
|
||||
$row->oed_debit = $item["debit"];
|
||||
$row->save();
|
||||
}
|
||||
$cn->commit();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$cn->rollback();
|
||||
echo $e->getMessage();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
}
|
||||
public function display_result()
|
||||
{
|
||||
echo h2("Ouverture compte");
|
||||
|
||||
parent::display_result(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
}
|
||||
|
|
@ -50,16 +50,16 @@ class Print_Ledger_Detail_Item extends Print_Ledger
|
|||
$this->Ln(20);
|
||||
$high=6;
|
||||
$this->SetFont('DejaVu', '', 6);
|
||||
$this->Cell(20, $high, _('Date'),0, 'L', false);
|
||||
$this->Cell(20, $high, _('Numéro interne'), 0, 0, 'L', false);
|
||||
$this->Cell(50, $high, _('Code'),0,'L',false);
|
||||
$this->Cell(80, $high, _('Libellé'),0,'L',false);
|
||||
$this->Cell(20, $high, _('Tot HTVA'), 0, 0, 'R', false);
|
||||
$this->Cell(20, $high, _('Tot TVA NP'), 0, 0, 'R', false);
|
||||
$this->Cell(20, $high, _("Autre Tx"), 0, 0, 'R', false);
|
||||
$this->Cell(20, $high, _('Tot TVA'), 0, 0, 'R', false);
|
||||
$this->Cell(20, $high, _('TVAC'), 0, 0, 'R', false);
|
||||
$this->Ln(6);
|
||||
$this->write_cell(20, $high, _('Date'),0,0, 'L', false);
|
||||
$this->write_cell(20, $high, _('Numéro interne'), 0,0, 'L', false);
|
||||
$this->write_cell(50, $high, _('Code'),0,0,'L',false);
|
||||
$this->write_cell(80, $high, _('Libellé'),0,0,'L',false);
|
||||
$this->write_cell(20, $high, _('Tot HTVA'), 0, 0,'R', false,'R', false);
|
||||
$this->write_cell(20, $high, _('Tot TVA NP'), 0, 0,'R', false, false);
|
||||
$this->write_cell(20, $high, _("Autre Tx"), 0, 0, 'R', false);
|
||||
$this->write_cell(20, $high, _('Tot TVA'), 0, 0, 'R', false);
|
||||
$this->write_cell(20, $high, _('TVAC'), 0, 0, 'R', false);
|
||||
$this->line_new(6);
|
||||
$this->show_col=true;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ class Sendmail extends Sendmail_Core
|
|||
{
|
||||
$max_email = $p_repo->get_value("select dos_email from ac_dossier where dos_id=$1",
|
||||
array($p_dossier_id));
|
||||
if ($max_email == "") return 0;
|
||||
return $max_email;
|
||||
}
|
||||
/**
|
||||
|
|
@ -109,10 +110,48 @@ class Sendmail extends Sendmail_Core
|
|||
|
||||
$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));
|
||||
if ($email_sent == "") return 0;
|
||||
return $email_sent;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if there is a mandatory domain, if yes
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
function verify()
|
||||
{
|
||||
try {
|
||||
parent::verify();
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
if ( defined('ALLOWED_EMAIL_DOMAIN') )
|
||||
{
|
||||
if ( ALLOWED_EMAIL_DOMAIN != "")
|
||||
{
|
||||
$as_domain=explode(",", ALLOWED_EMAIL_DOMAIN);
|
||||
$valid=0;
|
||||
foreach ($as_domain as $domain) {
|
||||
$domain="@$domain";
|
||||
if (strpos($this->from,$domain) != 0 ) {
|
||||
$valid=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( $valid == 0) {
|
||||
throw new Exception("Domaine email {$this->from} interdit",EXC_INVALID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add $p_amount_email to email sent
|
||||
* @param $p_repo Database
|
||||
|
|
|
|||
|
|
@ -88,4 +88,7 @@ define ("DEBUGNOALYSS",0);
|
|||
// define ("AUDIT_ENABLE",true);
|
||||
//
|
||||
// display a captcha
|
||||
// define ("NOALYSS_CAPTCHA",true);
|
||||
// define ("NOALYSS_CAPTCHA",true);
|
||||
// When sending an email , the domain of this email must be in comma separated list ,
|
||||
// if the list is an empty string then all the domain are allowed
|
||||
// define ('ALLOWED_EMAIL_DOMAIN','');
|
||||
|
|
@ -67,6 +67,7 @@ if (strpos($inc_path, ";") != 0) {
|
|||
set_include_path($new_path);
|
||||
@ini_set('default_charset', "UTF-8");
|
||||
@ini_set('session.use_cookies', 1);
|
||||
// deprecated
|
||||
@ini_set('magic_quotes_gpc', 'off');
|
||||
|
||||
if (!defined('OVERRIDE_PARAM')) {
|
||||
|
|
@ -122,7 +123,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
|
|||
if (!defined("SYSINFO_DISPLAY")) {
|
||||
define("SYSINFO_DISPLAY", TRUE);
|
||||
}
|
||||
define("DBVERSION", 190);
|
||||
define("DBVERSION", 191);
|
||||
define("MONO_DATABASE", 25);
|
||||
define("DBVERSIONREPO", 20);
|
||||
define('NOTFOUND', '--not found--');
|
||||
|
|
@ -340,6 +341,7 @@ define('EXC_PARAM_VALUE', 1005);
|
|||
define('EXC_PARAM_TYPE', 1006);
|
||||
define('EXC_DUPLICATE', 1200);
|
||||
define('EXC_INVALID', 1400);
|
||||
define('EXC_FORBIDDEN', 1500);
|
||||
define("UNPINDG", "");
|
||||
define("PINDG", "");
|
||||
|
||||
|
|
|
|||
79
include/database/operation_exercice_detail_sql.class.php
Normal file
79
include/database/operation_exercice_detail_sql.class.php
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?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 Dany WM De Bontridder($(YEAR))
|
||||
*
|
||||
* $(DATE)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief abstract of the table
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @brief abstract of the table
|
||||
*/
|
||||
class Operation_Exercice_Detail_SQL extends Table_Data_SQL
|
||||
{
|
||||
|
||||
function __construct(DatabaseCore $p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "operation_exercice_detail";
|
||||
$this->primary_key = "oed_id";
|
||||
/*
|
||||
* List of columns
|
||||
*/
|
||||
$this->name = array(
|
||||
'oed_id' => 'oed_id'
|
||||
, 'oe_id' => 'oe_id'
|
||||
, 'oed_poste' => 'oed_poste'
|
||||
, 'oed_qcode' => 'oed_qcode'
|
||||
, 'oed_label' => 'oed_label'
|
||||
, 'oed_amount' => 'oed_amount'
|
||||
, 'oed_debit' => 'oed_debit'
|
||||
|
||||
|
||||
);
|
||||
/*
|
||||
* Type of columns
|
||||
*/
|
||||
$this->type = array(
|
||||
'oed_id' => 'number'
|
||||
, 'oe_id' => 'number'
|
||||
, 'oed_poste' => 'text'
|
||||
, 'oed_qcode' => 'text'
|
||||
, 'oed_label' => 'text'
|
||||
, 'oed_amount' => 'number'
|
||||
, 'oed_debit' => 'text'
|
||||
|
||||
);
|
||||
|
||||
$this->default = array(
|
||||
"oed_id" => "oed_id"
|
||||
);
|
||||
|
||||
|
||||
|
||||
$this->date_format = "DD.MM.YYYY";
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
82
include/database/operation_exercice_sql.class.php
Normal file
82
include/database/operation_exercice_sql.class.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?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 Dany WM De Bontridder($(YEAR))
|
||||
*
|
||||
* $(DATE)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief abstract of the table public.operation_exercice
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @brief abstract of the table public.operation_exercice
|
||||
*/
|
||||
class Operation_Exercice_SQL extends Table_Data_SQL
|
||||
{
|
||||
|
||||
function __construct(DatabaseCore $p_cn, $p_id = -1)
|
||||
{
|
||||
$this->table = "public.operation_exercice";
|
||||
$this->primary_key = "oe_id";
|
||||
/*
|
||||
* List of columns
|
||||
*/
|
||||
$this->name = array(
|
||||
"oe_id" => "oe_id",
|
||||
"oe_date" => "oe_date",
|
||||
"oe_text" => "oe_text",
|
||||
"oe_type" => "oe_type",
|
||||
"tech_user" => "tech_user",
|
||||
"tech_date" => "tech_date",
|
||||
"oe_dossier_id" => "oe_dossier_id",
|
||||
"oe_exercice" => "oe_exercice",
|
||||
"oe_transfer_date"=>"oe_transfer_date"
|
||||
|
||||
);
|
||||
/*
|
||||
* Type of columns
|
||||
*/
|
||||
$this->type = array(
|
||||
"oe_id" => "number",
|
||||
"oe_date" => "date",
|
||||
"oe_text" => "text",
|
||||
"oe_type" => "text",
|
||||
"tech_user" => "text",
|
||||
"tech_date" => "date",
|
||||
"oe_dossier_id" => "number",
|
||||
"oe_exercice" => "number",
|
||||
"oe_transfer_date"=>"date"
|
||||
);
|
||||
|
||||
|
||||
$this->default = array(
|
||||
"oe_id" => "oe_id",
|
||||
"tech_user" => "tech_user",
|
||||
"tech_date" => "tech_date",
|
||||
);
|
||||
|
||||
$this->date_format = "DD.MM.YYYY";
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -101,12 +101,21 @@ foreach ($row as $r)
|
|||
$export->add($r['sum_deb'],"number");
|
||||
$export->add($r['sum_cred'],"number");
|
||||
|
||||
if ( $delta < 0 ){
|
||||
if ( $delta < 0){
|
||||
$export->add("0","number");
|
||||
$export->add(abs($delta),"number");
|
||||
}else {
|
||||
$export->add(abs($delta),"number");
|
||||
$export->add($r['solde_cred'],"number");
|
||||
}elseif ( $delta > 0 ) {
|
||||
$export->add($r['solde_deb'],"number");
|
||||
$export->add("0","number");
|
||||
}elseif ($delta==0 && $r['poste']!="")
|
||||
{
|
||||
$export->add("0","number");
|
||||
$export->add("0","number");
|
||||
}elseif ( $delta == 0 && $r['poste'] =="" ) {
|
||||
$export->add($r['solde_deb'],"number");
|
||||
$export->add($r['solde_cred'],"number");
|
||||
} else {
|
||||
throw new \Exception(__FILE__.":".__LINE__);
|
||||
}
|
||||
$export->write();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,13 +210,7 @@ if (!empty($array)) {
|
|||
$nlvl3[$a] = bcadd($nlvl3[$a], $r[$a]);
|
||||
}
|
||||
|
||||
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->LongLine(30, 6, $value['poste'], 0, 'L', $fill);
|
||||
$pdf->LongLine(60, 6, $value['label'], 0, 'L', $fill);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ join fiche_detail f on (a.f_id=f.f_id)
|
|||
join fiche_def fd on (fd.fd_id=f1.fd_id)
|
||||
join jnt_fic_attr jfa on (fd.fd_id=jfa.fd_id and jfa.ad_id=f.ad_id)
|
||||
where ag_id=$1
|
||||
order by f1.fd_id, a.f_id,jnt_order;;",[$ag_id]);
|
||||
order by f1.fd_id, a.f_id,jnt_order",[$ag_id]);
|
||||
|
||||
$nb=count($aRow);
|
||||
$lastcat=0;$lastcard=0;
|
||||
|
|
@ -105,5 +105,14 @@ where ag_id=$1 and f_id=$2 order by cor_id",array($ag_id,$lastcard));
|
|||
$csv->add($aRow[$i]['ad_value']);
|
||||
|
||||
}
|
||||
|
||||
$aOption=$cn->get_array(" select ap_value
|
||||
from
|
||||
action_person a
|
||||
join action_person_option apo on (a.ap_id=apo.action_person_id)
|
||||
join contact_option_ref cor on (cor.cor_id=apo.contact_option_ref_id)
|
||||
where ag_id=$1 and f_id=$2 order by cor_id",array($ag_id,$lastcard));
|
||||
$nb_option=count($aOption);
|
||||
for ($h=0;$h < $nb_option;$h++) {
|
||||
$csv->add($aOption[$h]['ap_value']);
|
||||
}
|
||||
$csv->write();
|
||||
|
|
@ -1444,7 +1444,7 @@ function confirm_with_string($p_ctl_name,$p_car)
|
|||
{
|
||||
$code=generate_random_string($p_car );
|
||||
$r = HtmlInput::hidden("ctlcode",$code);
|
||||
$r.='<span style="margin-left:1.2em;margin-right:1.2em;font-size:112%;font-weight:bold">'. $code.'</span>';
|
||||
$r.='<span style="margin-left:1.2em;margin-right:1.2em;font-size:112%;font-weight:bold;border:navy solid 1px ; padding:0.5rem">'. $code.'</span>';
|
||||
$ctl=new IText($p_ctl_name);
|
||||
$r.=$ctl->input();
|
||||
return $r;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/*!\file
|
||||
/*!
|
||||
\file
|
||||
* \brief functions concerning the config file config.inc.php. The domain is not set into the form for security issues
|
||||
*/
|
||||
|
||||
|
|
@ -40,7 +41,8 @@ function is_unix()
|
|||
}
|
||||
|
||||
|
||||
/*!\brief
|
||||
/*
|
||||
* !\brief
|
||||
*\param array with the index
|
||||
* - ctmp temporary folder
|
||||
* - cpath path to postgresql
|
||||
|
|
@ -112,63 +114,60 @@ function config_file_form($p_array=null)
|
|||
require NOALYSS_TEMPLATE.'/template_config_form.php';
|
||||
}
|
||||
/**
|
||||
* Display the content of the config.inc.php with variables
|
||||
* @brief Display the content of the config.inc.php with variables
|
||||
* @param type $p_array
|
||||
* @param type $from_setup
|
||||
* @param type $p_os
|
||||
*/
|
||||
function display_file_config($p_array,$from_setup=1,$p_os=1)
|
||||
function display_file_config($p_array, $from_setup = 1, $p_os = 1)
|
||||
{
|
||||
extract($p_array, EXTR_SKIP);
|
||||
print ('<?php ');
|
||||
print ("\r\n");
|
||||
print ( 'date_default_timezone_set (\'Europe/Brussels\');');
|
||||
print ("\r\n");
|
||||
print ( "\$_ENV['TMP']='".$ctmp."';");
|
||||
print ("\r\n");
|
||||
print ( 'define("PG_PATH","'.$cpath.'");');
|
||||
print ("\r\n");
|
||||
if ( $p_os == 1 )
|
||||
{
|
||||
print ( 'define("PG_RESTORE","'.$cpath.DIRECTORY_SEPARATOR.'pg_restore ");');
|
||||
print ("\r\n");
|
||||
print ( 'define("PG_DUMP","'.$cpath.DIRECTORY_SEPARATOR.'pg_dump ");');
|
||||
print ("\r\n");
|
||||
print ( 'define ("PSQL","'.$cpath.DIRECTORY_SEPARATOR.'psql");');
|
||||
echo PHP_EOL;
|
||||
print ('date_default_timezone_set (\'Europe/Brussels\');');
|
||||
echo PHP_EOL;
|
||||
print ("\$_ENV['TMP']='" . $ctmp . "';");
|
||||
echo PHP_EOL;
|
||||
print ('define("PG_PATH","' . $cpath . '");');
|
||||
echo PHP_EOL;
|
||||
if ($p_os == 1) {
|
||||
print ('define("PG_RESTORE","' . $cpath . DIRECTORY_SEPARATOR . 'pg_restore ");');
|
||||
echo PHP_EOL;
|
||||
print ('define("PG_DUMP","' . $cpath . DIRECTORY_SEPARATOR . 'pg_dump ");');
|
||||
echo PHP_EOL;
|
||||
print ('define ("PSQL","' . $cpath . DIRECTORY_SEPARATOR . 'psql");');
|
||||
} else {
|
||||
print ('define("PG_RESTORE","pg_restore.exe");');
|
||||
echo PHP_EOL;
|
||||
print ('define("PG_DUMP","pg_dump.exe");');
|
||||
echo PHP_EOL;
|
||||
print ('define ("PSQL","psql.exe");');
|
||||
}
|
||||
else
|
||||
{
|
||||
print ( 'define("PG_RESTORE","pg_restore.exe");');
|
||||
print ("\r\n");
|
||||
print ( 'define("PG_DUMP","pg_dump.exe");');
|
||||
print ("\r\n");
|
||||
print ( 'define ("PSQL","psql.exe");');
|
||||
}
|
||||
print ("\r\n");
|
||||
print ( 'define ("noalyss_user","'.$cuser.'");');
|
||||
print ("\r\n");
|
||||
print ( 'define ("noalyss_password","'.$cpasswd.'");');
|
||||
print ("\r\n");
|
||||
print ( 'define ("noalyss_psql_port","'.$cport.'");');
|
||||
print ("\r\n");
|
||||
print ( 'define ("noalyss_psql_host","'.$chost.'");');
|
||||
print ("\r\n");
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ('define ("noalyss_user","' . $cuser . '");');
|
||||
echo PHP_EOL;
|
||||
print ('define ("noalyss_password","' . $cpasswd . '");');
|
||||
echo PHP_EOL;
|
||||
print ('define ("noalyss_psql_port","' . $cport . '");');
|
||||
echo PHP_EOL;
|
||||
print ('define ("noalyss_psql_host","' . $chost . '");');
|
||||
echo PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
print ("// If you change the NOALYSS_ADMINISTRATOR , you will need to rerun http://..../noalyss/html/install.php");
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ("// But it doesn't change the password");
|
||||
print ("\r\n");
|
||||
print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");');
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ('define ("NOALYSS_ADMINISTRATOR","' . $cadmin . '");');
|
||||
echo PHP_EOL;
|
||||
print ("// For changing the password of admin, go to preference or update in db");
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ("// this password is only used when executing install.php ");
|
||||
print ("\r\n");
|
||||
print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$cpassword_admin.'");');
|
||||
print ("\r\n");
|
||||
|
||||
print ( 'define ("LOCALE",'.$clocale.');');
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ('define ("NOALYSS_ADMIN_PASSWORD","' . $cpassword_admin . '");');
|
||||
echo PHP_EOL;
|
||||
|
||||
print ('define ("LOCALE",' . $clocale . ');');
|
||||
echo PHP_EOL;
|
||||
echo "
|
||||
/*
|
||||
* DEBUGNOALYSS let you see more information when you develop.
|
||||
|
|
@ -176,92 +175,125 @@ function display_file_config($p_array,$from_setup=1,$p_os=1)
|
|||
* 1 = display all errors
|
||||
* 2 = display all errors + more information
|
||||
*/
|
||||
";
|
||||
|
||||
print ("\r\n");
|
||||
print ( 'define ("DEBUGNOALYSS",0);');
|
||||
print ("\r\n");
|
||||
|
||||
print ( 'define ("domaine","");');
|
||||
print ("\r\n");
|
||||
if (isset($multi))
|
||||
{
|
||||
print ( 'define ("MULTI",0);');
|
||||
";
|
||||
|
||||
echo PHP_EOL;
|
||||
print ('define ("DEBUGNOALYSS",0);');
|
||||
echo PHP_EOL;
|
||||
|
||||
print ('define ("domaine","");');
|
||||
echo PHP_EOL;
|
||||
if (isset($multi)) {
|
||||
print ('define ("MULTI",0);');
|
||||
}
|
||||
if (!isset($multi))
|
||||
{
|
||||
print ( 'define ("MULTI",1);');
|
||||
if (!isset($multi)) {
|
||||
print ('define ("MULTI",1);');
|
||||
}
|
||||
print ("\r\n");
|
||||
print ( 'define ("dbname","'.$cdbname.'");');
|
||||
print ("\r\n");
|
||||
|
||||
echo PHP_EOL;
|
||||
print ('define ("dbname","' . $cdbname . '");');
|
||||
echo PHP_EOL;
|
||||
|
||||
print (' // Uncomment to log your input');
|
||||
print ("\r\n");
|
||||
print ( '// define ("LOGINPUT",TRUE);');
|
||||
print ("\r\n");
|
||||
print ("\r\n");
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ('// define ("LOGINPUT",TRUE);');
|
||||
echo PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
print (' // Do not change below !!!');
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print (' // These variable are computed but could be changed in ');
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print (' // very special configuration');
|
||||
print ("\r\n");
|
||||
print ( '// define ("NOALYSS_HOME","");');
|
||||
print ("\r\n");
|
||||
print ( '// define ("NOALYSS_PLUGIN","");');
|
||||
print ("\r\n");
|
||||
print ( '// define ("NOALYSS_INCLUDE","");');
|
||||
print ("\r\n");
|
||||
print ( '// define ("NOALYSS_TEMPLATE","");');
|
||||
print ("\r\n");
|
||||
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");
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS_HOME","");');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS_PLUGIN","");');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS_INCLUDE","");');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS_TEMPLATE","");');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS_INCLUDE","");');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS_TEMPLATE","");');
|
||||
echo PHP_EOL;
|
||||
print ("// Fix an issue with PDF when exporting receipt in PDF in ANCGL");
|
||||
print ('// define ("FIX_BROKEN_PDF","NO");');
|
||||
echo PHP_EOL;
|
||||
print ("// Uncomment if you want to convert to PDF");
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ("// With the unoconv tool");
|
||||
print ("\r\n");
|
||||
print ( "//define ('OFFICE','HOME=/tmp unoconv ');");
|
||||
print ("\r\n");
|
||||
echo PHP_EOL;
|
||||
print ("//define ('OFFICE','HOME=/tmp unoconv ');");
|
||||
echo PHP_EOL;
|
||||
print ("//define ('GENERATE_PDF','YES');");
|
||||
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");
|
||||
print ( '// define ("SITE_UPDATE","");'."\r\n");
|
||||
print ( '// define ("SITE_UPDATE_PLUGIN","");'."\r\n");
|
||||
print ( '// To allow to access the Info system'."\r\n");
|
||||
print ( '// define ("SYSINFO_DISPLAY",true);'."\r\n");
|
||||
print ( '// For developpement'."\r\n");
|
||||
print ( '// define ("NOALYSS VERSION",9999);'."\r\n");
|
||||
print (' // If you want to override the parameters you have to define OVERRIDE_PARAM'."\r\n");
|
||||
print ('// and give your own parameters for max_execution_time and memory_limit'."\r\n");
|
||||
print ("// define ('OVERRIDE_PARAM',1);\r\n");
|
||||
print ("// ini_set ('max_execution_time',240);\r\n");
|
||||
print ("// ini_set ('memory_limit','256M');\r\n");
|
||||
print ("// In recent distribution linux, pdftk is a snap, you should set the path\r\n");
|
||||
print ("// for exporting document in PDF\r\n");
|
||||
print ("// \$pdftk = /usr/bin/pdftk \r\n");
|
||||
print ("// \$pdftk = /snap/bin/pdftk \r\n");
|
||||
print ("// uncomment to activate the captcha on login page\r\n");
|
||||
print ("// define('NOALYSS_CAPTCHA',true);\r\n");
|
||||
print ("// Uncomment if you want to activate the possibility to reinitialize;\r\n");
|
||||
print ("// password by email\r\n");
|
||||
print ("// defined('RECOVER','1');\r\n");
|
||||
print ("// Uncomment and define if you want to Name of the sender of the email \r\n");
|
||||
print ("// if you activate the possibility to reinitialize password by email\r\n");
|
||||
print ("// define('ADMIN_WEB', 'www-data@localhost');\r\n");
|
||||
print ("// Define a random session key if you work with different version of NOALYSS\r\n");
|
||||
printf ("define ('SESSION_KEY','%s');",generate_random_string(10)) ;
|
||||
echo PHP_EOL;
|
||||
print ("// Uncomment if you don't want ");
|
||||
echo PHP_EOL;
|
||||
print ("// to be informed when a new release is ");
|
||||
echo PHP_EOL;
|
||||
print ("// published");
|
||||
echo PHP_EOL;
|
||||
print ('// define ("SITE_UPDATE","");');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("SITE_UPDATE_PLUGIN","");');
|
||||
echo PHP_EOL;
|
||||
print ('// To allow to access the Info system');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("SYSINFO_DISPLAY",true);');
|
||||
echo PHP_EOL;
|
||||
print ('// For developpement');
|
||||
echo PHP_EOL;
|
||||
print ('// define ("NOALYSS VERSION",9999);');
|
||||
echo PHP_EOL;
|
||||
print (' // If you want to override the parameters you have to define OVERRIDE_PARAM');
|
||||
echo PHP_EOL;
|
||||
print ('// and give your own parameters for max_execution_time and memory_limit');
|
||||
echo PHP_EOL;
|
||||
print ("// define ('OVERRIDE_PARAM',1);");
|
||||
echo PHP_EOL;
|
||||
print ("// ini_set ('max_execution_time',240);");
|
||||
echo PHP_EOL;
|
||||
print ("// ini_set ('memory_limit','256M');");
|
||||
echo PHP_EOL;
|
||||
print ("// In recent distribution linux, pdftk is a snap, you should set the path");
|
||||
echo PHP_EOL;
|
||||
print ("// for exporting document in PDF");
|
||||
echo PHP_EOL;
|
||||
print ("// \$pdftk = /usr/bin/pdftk ");
|
||||
echo PHP_EOL;
|
||||
print ("// \$pdftk = /snap/bin/pdftk ");
|
||||
echo PHP_EOL;
|
||||
print ("// uncomment to activate the captcha on login page");
|
||||
echo PHP_EOL;
|
||||
print ("// define('NOALYSS_CAPTCHA',true);");
|
||||
echo PHP_EOL;
|
||||
print ("// Uncomment if you want to activate the possibility to reinitialize;");
|
||||
echo PHP_EOL;
|
||||
print ("// password by email");
|
||||
echo PHP_EOL;
|
||||
print ("// define ('RECOVER','1');");
|
||||
echo PHP_EOL;
|
||||
print ("// Uncomment and define if you want to Name of the sender of the email ");
|
||||
echo PHP_EOL;
|
||||
print ("// if you activate the possibility to reinitialize password by email");
|
||||
echo PHP_EOL;
|
||||
print ("// define('ADMIN_WEB', 'www-data@localhost');");
|
||||
echo PHP_EOL;
|
||||
print ("// Define a random session key if you work with different version of NOALYSS");
|
||||
echo PHP_EOL;
|
||||
printf("define ('SESSION_KEY','%s');", generate_random_string(10));
|
||||
echo PHP_EOL;
|
||||
printf("// When sending an email , the domain of this email must be in comma separated list ,");
|
||||
echo PHP_EOL;
|
||||
print ("// if the list is an empty string then all the domain are allowed");
|
||||
echo PHP_EOL;
|
||||
printf("// define ('ALLOWED_EMAIL_DOMAIN','');");
|
||||
echo PHP_EOL;
|
||||
|
||||
}
|
||||
/*!\brief create the config file
|
||||
/*!
|
||||
* \brief create the config file
|
||||
*/
|
||||
function config_file_create($p_array,$from_setup,$p_os=1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -306,6 +306,17 @@ class Icon_Action
|
|||
$p_javascript);
|
||||
return $r;
|
||||
}
|
||||
|
||||
static function detail_anchor($p_id,$url)
|
||||
{
|
||||
$r=sprintf('
|
||||
<A HREF="%s">
|
||||
<span id="%s" class="smallicon icon" style="margin-left:5px"></span></A>',
|
||||
$url
|
||||
,$p_id);
|
||||
|
||||
return $r;
|
||||
}
|
||||
static function more($p_id,$p_javascript)
|
||||
{
|
||||
$r=sprintf('<span id="%s" onclick="%s" class="smallicon icon" style="margin-left:5px"></span>',
|
||||
|
|
|
|||
|
|
@ -184,7 +184,32 @@ class PDF_Core extends TFPDF
|
|||
}
|
||||
return false;
|
||||
}
|
||||
private function print_row()
|
||||
|
||||
/**
|
||||
* @brief print the current array of cell and reset it , if different colors are set on the same row
|
||||
* you have to print it before changing
|
||||
*@code
|
||||
* // fill red , text white
|
||||
* $this->SetFillColor(255,0,0);
|
||||
* $this->SetTextColor(255,255,255);
|
||||
* $this->write_cell(15,5,"PRICE",0,0,'R',fill:true);
|
||||
*
|
||||
* // print the cell without a linefeed
|
||||
* $this->print_row();
|
||||
*
|
||||
* // text in black on green
|
||||
*
|
||||
* $this->SetTextColor(0,0,0);
|
||||
* $this->SetFillColor(0,255,0);
|
||||
*
|
||||
* $this->write_cell(15,5,nbm($other['price']),0,0,'R');
|
||||
*@endcode
|
||||
* @see TFPDF::SetTextColor()
|
||||
* @see TFPDF::SetFillColor()
|
||||
* @see TFPDF::SetFontSize()
|
||||
* @return void
|
||||
*/
|
||||
protected function print_row()
|
||||
{
|
||||
static $e=0;
|
||||
$e++;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class Select_Box
|
|||
private $position; //!< change depending if we are in an absolute block or not
|
||||
protected $style_box;
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @param type $p_id javascript DOMid
|
||||
|
|
|
|||
|
|
@ -106,9 +106,9 @@ class Sendmail_Core
|
|||
for ($i = 0; $i < count($array); $i++)
|
||||
{
|
||||
$name = $array[$i];
|
||||
if (trim($this->$name) == "")
|
||||
if (trim($this->$name??"") == "")
|
||||
{
|
||||
throw new Exception( sprintf(_("%s est vide"),$name));
|
||||
throw new Exception( sprintf(_("%s est vide"),$name),EXC_INVALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,22 @@ abstract class Table_Data_SQL extends Data_SQL
|
|||
$sql=" delete from ".$this->table." where ".$this->primary_key."= $1";
|
||||
$this->cn->exec_sql($sql,array($this->$pk));
|
||||
}
|
||||
/**
|
||||
* @brief update the value of a column with an expression for $value for the current record
|
||||
* @param $column_exp string like column = $1 or column=function($1)
|
||||
* @param $value value replacing $1
|
||||
* @note you can use it for entering a date with the hour and minute like this
|
||||
* $this->column_update("field_date = to_date($1,'DD.MM.YY HH24:MI'),date('d.m.Y H:i'))
|
||||
*
|
||||
* @return Table_Data_SQL
|
||||
*/
|
||||
function column_update($column_expr,$value) {
|
||||
$pk=$this->primary_key;
|
||||
$sql="update ".$this->table." set {$column_expr} where {$this->primary_key} = $2";
|
||||
$this->cn->exec_sql($sql,[$value,$this->$pk]);
|
||||
return $this;
|
||||
|
||||
}
|
||||
public function update()
|
||||
{
|
||||
$this->verify();
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ if ($sa=='step4')
|
|||
$amount='amount'.$idx;
|
||||
$ck='ck'.$idx;
|
||||
$result[$qcode]=$row['j_qcode'];
|
||||
if (trim($row['j_qcode'])=='')
|
||||
if (trim($row['j_qcode']??"")=='')
|
||||
$result[$poste]=$row['j_poste'];
|
||||
$result[$amount]=abs($row['solde']);
|
||||
if ($row['solde']>0)
|
||||
|
|
|
|||
77
include/operation_exercice.inc.php
Normal file
77
include/operation_exercice.inc.php
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?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 6/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief For opening or closing exercice , operation needed
|
||||
*/
|
||||
|
||||
$http=new HttpInput();
|
||||
if ( $http->request("sa","string","") == "" )
|
||||
{
|
||||
Operation_Exercice::input_source();
|
||||
Operation_Exercice::list_draft();
|
||||
return;
|
||||
|
||||
}
|
||||
if ( $http->request("sa","string" ) == "remove" )
|
||||
{
|
||||
Operation_Exercice::delete($http->post("operation_list"));
|
||||
Operation_Exercice::input_source();
|
||||
Operation_Exercice::list_draft();
|
||||
return;
|
||||
}
|
||||
if ( $http->request("sa") == "opening")
|
||||
{
|
||||
|
||||
$operation_exercice_id= $http->get("operation_exercice_id","number",-1);
|
||||
$operation_opening=new Operation_Opening($operation_exercice_id);
|
||||
try {
|
||||
if ( $operation_exercice_id == -1 ) {
|
||||
// take data from request
|
||||
$operation_opening->from_request();
|
||||
$operation_opening->insert();
|
||||
}
|
||||
// Display result
|
||||
$operation_opening->display_result();
|
||||
$operation_opening->input_transfer();
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( $http->request("sa") == "closing")
|
||||
{
|
||||
|
||||
$operation_exercice_id= $http->get("operation_exercice_id","number",-1);
|
||||
$operation_closing=new Operation_Closing($operation_exercice_id);
|
||||
try {
|
||||
if ( $operation_exercice_id == -1 ) {
|
||||
// take data from request
|
||||
$operation_closing->from_request();
|
||||
$operation_closing->insert();
|
||||
}
|
||||
// Display result
|
||||
$operation_closing->display_result();
|
||||
$operation_closing->input_transfer();
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
* \brief to write into the ledgers ODS a new operation
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
\Noalyss\Dbg::echo_file(__FILE__);
|
||||
|
||||
|
||||
global $g_user,$g_parameter,$http;
|
||||
|
|
@ -85,30 +86,41 @@ $default_currency=new Acc_Currency($cn,0);
|
|||
|
||||
echo $ledger->input($p_post);
|
||||
|
||||
$style=' style="display:inline-block;width: 15rem;text-align: right"';
|
||||
?>
|
||||
<div style="position:absolute;right:20px">
|
||||
<table class="info_op">
|
||||
<tr>
|
||||
<td style="border:1px solid "><?=_('Totaux')?></td>
|
||||
<td style="border:1px solid lightgrey"><?= _('Débit') ?>
|
||||
<span id="totalDeb" <?=$style?>></span>
|
||||
</td>
|
||||
<td style="border:1px solid lightgrey"><?= _('Crédit') ?>
|
||||
<span id="totalCred" <?=$style?>></span>
|
||||
</td>
|
||||
<td style="border:1px solid lightgrey"><?= _('Difference') ?>
|
||||
<span id="totalDiff" <?=$style?>></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php // For currency ?>
|
||||
<tr id="row_currency">
|
||||
<td style="border:1px solid "><?=$default_currency->get_code()?></td>
|
||||
|
||||
<td style="border:1px solid lightgrey"><?= _('Débit') ?>
|
||||
<span id="default_currency_deb" <?=$style?>></span>
|
||||
</td>
|
||||
|
||||
<td style="border:1px solid lightgrey"><?= _('Crédit') ?>
|
||||
<span id="default_currency_cred" <?=$style?>></span>
|
||||
</td>
|
||||
|
||||
echo '<div style="position:absolute;width:40%;right:20px">';
|
||||
echo '<table class="info_op">'.
|
||||
'<tr>'.td('').
|
||||
td(_('Débit')) .
|
||||
'<td id="totalDeb" class="num"></td>' .
|
||||
td(_('Crédit')) .
|
||||
' <td id="totalCred" class="num"></td>' .
|
||||
td(_('Difference')) .
|
||||
' <td id="totalDiff"></td>'.
|
||||
'</tr>';
|
||||
// For currency
|
||||
echo '<tr id="row_currency">'.td($default_currency->get_code()).
|
||||
td(_('Débit')) .
|
||||
'<td id="default_currency_deb" class="num"></td>' .
|
||||
td(_('Crédit')) .
|
||||
' <td id="default_currency_cred" class="num"></td>' .
|
||||
td().
|
||||
'</tr>';
|
||||
echo '</table>';
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
echo '</div>';
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$iconcerned=new IConcerned('jrn_concerned');
|
||||
$iconcerned->amount_id="totalDeb";
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ elseif ($action=="send_email") :
|
|||
|
||||
|
||||
if ($valid==true):
|
||||
$request_id=generate_random_string(SIZE_REQUEST,special: 0);
|
||||
$request_id=generate_random_string(SIZE_REQUEST, 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
|
||||
|
|
|
|||
99
include/sql/patch/upgrade190.sql
Normal file
99
include/sql/patch/upgrade190.sql
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
begin;
|
||||
|
||||
-- protect against wrong card in fiche_detail
|
||||
|
||||
CREATE OR REPLACE FUNCTION comptaproc.fiche_detail_check_qcode()
|
||||
RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
declare
|
||||
i record;
|
||||
begin
|
||||
if NEW.ad_id=23 and NEW.ad_value != OLD.ad_value then
|
||||
update jrnx set j_qcode=NEW.ad_value where j_qcode = OLD.ad_value;
|
||||
update op_predef_detail set opd_poste=NEW.ad_value where opd_poste=OLD.ad_value;
|
||||
for i in select ad_id from attr_def where ad_type = 'card' or ad_id=25 loop
|
||||
update fiche_detail set ad_value=NEW.ad_value where ad_value=OLD.ad_value and ad_id=i.ad_id;
|
||||
if i.ad_id=19 then
|
||||
update stock_goods set sg_code=NEW.ad_value where sg_code=OLD.ad_value;
|
||||
end if;
|
||||
|
||||
end loop;
|
||||
end if;
|
||||
return NEW;
|
||||
end;
|
||||
$function$;
|
||||
|
||||
drop trigger if exists fiche_detail_check_qcode_trg on public.fiche_detail ;
|
||||
drop function if exists comptaproc.fiche_detail_qcode_upd() cascade;
|
||||
|
||||
create trigger fiche_detail_check_qcode_trg before insert
|
||||
or update on
|
||||
public.fiche_detail for each row execute function comptaproc.fiche_detail_check_qcode();
|
||||
|
||||
|
||||
|
||||
update fiche_detail set ad_value=ad_value where ad_id in (select ad_id from attr_def where ad_type='card');
|
||||
|
||||
insert into parameter values ('MY_REPORT','N') ON CONFLICT DO NOTHING;
|
||||
|
||||
update menu_ref set me_file='payment_method.inc.php' where me_code='CFGPAY';
|
||||
|
||||
update menu_ref set me_menu='Principal' where me_code='COMPANY';
|
||||
update menu_ref set me_menu='Financier' where me_code='MENUFIN';
|
||||
|
||||
CREATE OR REPLACE FUNCTION comptaproc.set_tech_user()
|
||||
RETURNS trigger
|
||||
AS $function$
|
||||
declare
|
||||
/* variable */
|
||||
noalyss_user text;
|
||||
begin
|
||||
new.tech_user := current_setting('noalyss.user_login');
|
||||
new.tech_date := now();
|
||||
return NEW;
|
||||
|
||||
exception when others then
|
||||
new.tech_date := now();
|
||||
new.tech_user := current_user;
|
||||
return NEW;
|
||||
end ;
|
||||
$function$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
drop table if exists operation_exercice_detail;
|
||||
drop table if exists operation_exercice;
|
||||
|
||||
create table operation_exercice
|
||||
(
|
||||
oe_id bigint generated by default as identity primary key,
|
||||
oe_date date null,
|
||||
oe_type text not null check (oe_type = 'opening' or oe_type = 'closing'),
|
||||
oe_text text ,
|
||||
oe_dossier_id int not null,
|
||||
oe_exercice int not null,
|
||||
jr_internal text,
|
||||
oe_transfer_date timestamp,
|
||||
tech_user text,
|
||||
tech_date timestamp default now()
|
||||
);
|
||||
|
||||
create table operation_exercice_detail
|
||||
(
|
||||
oed_id bigint generated by default as identity primary key,
|
||||
oe_id bigint references operation_exercice (oe_id) on update cascade on delete cascade not null,
|
||||
oed_poste account_type ,
|
||||
oed_qcode text ,
|
||||
oed_label text,
|
||||
oed_amount numeric (20,4),
|
||||
oed_debit bool
|
||||
);
|
||||
|
||||
create trigger trg_set_tech_user before insert or update on operation_exercice for each row execute function comptaproc.set_tech_user();
|
||||
|
||||
update menu_ref set me_code='OPCL' , me_menu='Ouvert./Fermeture',me_file='operation_exercice.inc.php',me_description='Opération de cloture ou d''ouverture d''exercice'
|
||||
,me_description_etendue ='Ecriture d''ouverture ou de fermeture , , reporte les soldes des comptes de l''année passé du poste comptable 0xxx à 5xxxx sur l''année courante ou ferme les comptes de 6 à 7 de l''année '
|
||||
where me_code='OPEN';
|
||||
|
||||
insert into version (val,v_description) values (191,'cloture-ouverture exercice-version 9112');
|
||||
commit;
|
||||
|
|
@ -25,8 +25,10 @@ if (!defined('ALLOWED'))
|
|||
* @file
|
||||
* @brief display Financial operation , simple and detailled
|
||||
*/
|
||||
|
||||
echo \HtmlInput::filter_table("tb_print_ledger", "0,1,2,3,4,5,6,7,8,9", 1);
|
||||
?>
|
||||
<table class="result">
|
||||
<table class="result" id="tb_print_ledger">
|
||||
<tr>
|
||||
<th><?= _('Date') ?></th>
|
||||
<th><?= _('Banque') ?></th>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ if (!defined('ALLOWED'))
|
|||
* @file
|
||||
* @brief Display one purchase operation on one line , with the sum of VAT, ND...
|
||||
*/
|
||||
echo \HtmlInput::filter_table("tb_print_ledger", "0,1,2,3,4,5,6,7", 1);
|
||||
?>
|
||||
<TABLE class="result">
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@ if (!defined('ALLOWED'))
|
|||
* @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
|
||||
*/
|
||||
bcscale(2);
|
||||
$p_col=($nb_other_tax<>0)?"0,1,2,3,4,5,6,7,8,9,10,11":"0,1,2,3,4,5,6,7,8,9,10,11,12";
|
||||
echo \HtmlInput::filter_table("tb_print_ledger", $p_col, 1);
|
||||
|
||||
?>
|
||||
<table class="result">
|
||||
<table class="result" id="tb_print_ledger">
|
||||
<tr>
|
||||
<th>
|
||||
<?=_('Date')?>
|
||||
|
|
@ -49,28 +52,28 @@ bcscale(2);
|
|||
<th>
|
||||
<?=_('Description')?>
|
||||
</th>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('HTVA')?>
|
||||
</th>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('Non ded')?>
|
||||
</th>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('TVA')?>
|
||||
</th>
|
||||
<?php if ($nb_other_tax<>0) :?>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('Autre Taxe')?>
|
||||
</th>
|
||||
<?php endif;?>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('TVAC')?>
|
||||
</th>
|
||||
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('Devise')?>
|
||||
</th>
|
||||
<th>
|
||||
<th class="text-center">
|
||||
<?=_('Lien')?>
|
||||
</th>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ if (!defined('ALLOWED'))
|
|||
* @brief from Acc_Ledger_History_Sale::export_html_oneline
|
||||
* @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
|
||||
*/
|
||||
|
||||
echo \HtmlInput::filter_table("tb_print_ledger", "0,1,2,3,4,5,6", 1);
|
||||
?>
|
||||
<TABLE class="result">
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@
|
|||
* @brief detail of the list of operation with VAT and items
|
||||
*/
|
||||
bcscale(2);
|
||||
|
||||
|
||||
?>
|
||||
<table class="result">
|
||||
<table class="result" id="tb_print_ledger">
|
||||
<tr>
|
||||
<th>
|
||||
<?=_('Date')?>
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@
|
|||
* @brief
|
||||
* @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
|
||||
*/
|
||||
$p_col=($nb_other_tax<>0)?"0,1,2,3,4,5,6,7,8,9,10":"0,1,2,3,4,5,6,7,8,9,10,11";
|
||||
echo \HtmlInput::filter_table("tb_print_ledger", $p_col, 1);
|
||||
|
||||
?>
|
||||
<table class="result">
|
||||
<table class="result" id="tb_print_ledger">
|
||||
<tr>
|
||||
<th>
|
||||
<?=_('Date')?>
|
||||
|
|
@ -46,24 +48,27 @@
|
|||
<th>
|
||||
<?=_('Description')?>
|
||||
</th>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('HTVA')?>
|
||||
</th>
|
||||
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('TVA')?>
|
||||
</th>
|
||||
<?php if ($nb_other_tax>0) :?>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('Autre Taxe')?>
|
||||
</th>
|
||||
<?php endif;?>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('TVAC')?>
|
||||
</th>
|
||||
<th class="num">
|
||||
<th class="text-center">
|
||||
<?=_('Devise')?>
|
||||
</th>
|
||||
<th class="text-center">
|
||||
<?=_('Lien')?>
|
||||
</th>
|
||||
</tr>
|
||||
<?php
|
||||
$nb_data=count($this->data);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ for($i=0;$i<count($last_ledger);$i++):
|
|||
|
||||
</td>
|
||||
<td class="box">
|
||||
<?php echo h(mb_substr($last_ledger[$i]['jr_comment'],0,40,'UTF-8'))?>
|
||||
<?php echo h(mb_substr($last_ledger[$i]['jr_comment']??"",0,40,'UTF-8'))?>
|
||||
</td>
|
||||
<td class="box">
|
||||
<?php echo HtmlInput::detail_op($last_ledger[$i]['jr_id'], $last_ledger[$i]['jr_internal'])?>
|
||||
|
|
|
|||
|
|
@ -208,10 +208,10 @@ if ($aRap != null ) {
|
|||
array($internal));
|
||||
// add additional tax if any
|
||||
$add=$operation->get_sum_other_tax();
|
||||
$amount=bcadd($amount,$add,2);
|
||||
$amount=bcadd($amount??0,$add??0,2);
|
||||
break;
|
||||
}
|
||||
$total_rec=bcadd($total_rec,$amount);
|
||||
$total_rec=bcadd($total_rec,$amount??0);
|
||||
$str="modifyOperation(".$aRap[$e].",".$gDossier.")";
|
||||
|
||||
// If write access , allow to drop Reconciles operations
|
||||
|
|
|
|||
31
include/template/operation_exercice-input_row-error.php
Normal file
31
include/template/operation_exercice-input_row-error.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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 11/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief operation already transfered
|
||||
*/
|
||||
|
||||
Noalyss\Dbg::echo_file(__FILE__);
|
||||
echo \HtmlInput::title_box("", "operation_exercice_bx");
|
||||
|
||||
printf(_("Opération transférée le %s"),$operation->getp("oe_transfer_date") );
|
||||
echo '<ul class="aligned-block">';
|
||||
echo \HtmlInput::button_close("operation_exercice_bx") ;
|
||||
echo '</li>';
|
||||
114
include/template/operation_exercice-input_row.php
Normal file
114
include/template/operation_exercice-input_row.php
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?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 7/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief input data for one row of OPERATION_EXERCICE_DETAIL, inherited data $operation_detail_sql
|
||||
*
|
||||
* \see Operation_Exercice::input_row
|
||||
*/
|
||||
Noalyss\Dbg::echo_file(__FILE__);
|
||||
|
||||
$data = $operation_detail_sql->to_array();
|
||||
|
||||
if (DEBUGNOALYSS > 1) echo \Noalyss\Dbg::hidden_info("data", $data);
|
||||
|
||||
$poste = new \IPoste("oe_poste");
|
||||
$poste->value = $data['oed_poste'];
|
||||
$poste->id = 'oe_poste';
|
||||
$poste->set_attribute('gDossier', Dossier::id());
|
||||
$poste->set_attribute('jrn', 0);
|
||||
$poste->set_attribute('account', 'oe_poste');
|
||||
$label_id= uniqid('label');
|
||||
$poste->set_attribute('label',$label_id);
|
||||
|
||||
$poste->dbl_click_history();
|
||||
|
||||
|
||||
$card = new \ICard("qcode");
|
||||
$card->value = $data['oed_qcode'];
|
||||
$card->set_dblclick("fill_ipopcard(this);");
|
||||
$card->set_attribute('label', "label");
|
||||
$card->set_function('fill_data');
|
||||
$card->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $card->name);
|
||||
|
||||
$label = new IText("label", $data['oed_label']);
|
||||
$label->id=$label_id;
|
||||
$label->size = 80;
|
||||
|
||||
$amount = new INum("amount", $data['oed_amount']);
|
||||
|
||||
$checkbox = new ICheckBox("debit");
|
||||
|
||||
$checkbox->value = 't';
|
||||
$checkbox->selected =($data['oed_debit'] == 't')?true:false;
|
||||
|
||||
$checkbox->javascript='onclick="display_dcside(this)"';
|
||||
|
||||
echo \HtmlInput::title_box("", "operation_exercice_bx");
|
||||
?>
|
||||
<div>
|
||||
<form onsubmit="operation_exercice.save_row();return false;" id="operation_exercice_input_row_frm" method="POST">
|
||||
<?php
|
||||
echo Dossier::hidden();
|
||||
echo HtmlInput::hidden("ac", "OPCL");
|
||||
echo HtmlInput::hidden("row_id", $operation_detail_sql->oed_id);
|
||||
echo HtmlInput::hidden("op", 'operation_exercice+save_row');
|
||||
echo HtmlInput::hidden("oe_id", $operation_detail_sql->oe_id);
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="oe_poste"><?= _("Poste") ?></label>
|
||||
<?= $poste->input() ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="qcode"><?= _("Fiche") ?></label>
|
||||
<?= $card->input() ?>
|
||||
<?= $card->search() ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="oed_label"><?= _("Libellé") ?></label>
|
||||
<?= $label->input() ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amount"><?= _("Montant") ?></label>
|
||||
<?= $amount->input() ?>
|
||||
|
||||
<?= $checkbox->input() ?>
|
||||
<label for="debit">
|
||||
<span id="txtdebit">
|
||||
<?=($data['oed_debit']=="f")?_("Crédit"):_("Débit")?>
|
||||
</span>
|
||||
|
||||
</label>
|
||||
</div>
|
||||
<ul class="aligned-block">
|
||||
<li>
|
||||
<?= \HtmlInput::submit("save", _("Sauve")) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= \HtmlInput::button_close("operation_exercice_bx") ?>
|
||||
</li>
|
||||
<li>
|
||||
<?=\HtmlInput::button_action(_("Effacer"), sprintf("operation_exercice.delete_row('%s')", $data['oed_id']))?>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
129
include/template/operation_exercice-input_source.php
Normal file
129
include/template/operation_exercice-input_source.php
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<?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 6/01/24
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief input the source of the opening / closing operation
|
||||
*/
|
||||
|
||||
\Noalyss\Dbg::echo_file(__FILE__);
|
||||
|
||||
global $cn;
|
||||
global $g_user;
|
||||
global $g_parameter;
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// if DEBUG then show both , otherwise if MY_REPORT=Y shows opening otherwise , shows only closing
|
||||
// Show opening if report == Y or NOALYSS > 1
|
||||
//-------------------------------------------------------------------------------------------
|
||||
if ( $g_parameter->MY_REPORT=="Y" || DEBUGNOALYSS > 1) :
|
||||
?>
|
||||
<div class="content">
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<FORM method="POST">
|
||||
|
||||
<div class="" id="opening_div">
|
||||
<h2><?= _("Ouverture") ?></h2>
|
||||
<div class="text-muted">
|
||||
<?= _("Ouverture des comptes pour l'exercice qui débute pour les comptes 0 à 5.") ?>
|
||||
<?= ("Choisissez l'exercice clôturé (exercice N-1) du dossier à reporter pour les a-nouveaux (exercice N)") ?>
|
||||
</div>
|
||||
<?php
|
||||
/**************************************************************************
|
||||
* Needed information :
|
||||
* - Date of the first day of exercice
|
||||
* - Folder
|
||||
* - Exercice N-1
|
||||
*************************************************************************/
|
||||
$date = new IDate("date_opening");
|
||||
$avail = $g_user->get_available_folder();
|
||||
|
||||
|
||||
$array = array();
|
||||
$i = 0;
|
||||
foreach ($avail as $r) {
|
||||
$array[$i]['value'] = $r['dos_id'];
|
||||
$array[$i]['label'] = sprintf("%s %s (%s)",$r['dos_id'],$r['dos_name'],substr($r['dos_description']??"",0,50));
|
||||
$i++;
|
||||
}
|
||||
$sAvail = new ISelect('dos_id');
|
||||
$sAvail->id = "dos_id";
|
||||
$sAvail->selected = Dossier::id();
|
||||
$sAvail->value = $array;
|
||||
$sAvail->javascript = sprintf('onchange="operation_exercice.update_periode(%d)"',Dossier::id());
|
||||
|
||||
$exercice = $cn->make_array("select distinct p_exercice,p_exercice_label from parm_periode order by p_exercice desc");
|
||||
$sExercice = new ISelect("exercice");
|
||||
$sExercice->id = "select_exercice_id";
|
||||
$sExercice->value = $exercice;
|
||||
|
||||
echo HtmlInput::array_to_hidden(["gDossier","ac"],$_REQUEST);
|
||||
echo HtmlInput::hidden("sa","opening");
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="dos_id"><?= _("Depuis le dossier") ?></label>
|
||||
<?= $sAvail->input() ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="dos_id"><?= _("Exercice N-1") ?></label>
|
||||
<?= $sExercice->input() ?>
|
||||
</div>
|
||||
<?= \HtmlInput::submit("ope_submit", _("Valider")) ?>
|
||||
</div>
|
||||
</FORM>
|
||||
<?php
|
||||
endif;
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// Show closing if report == N or NOALYSS > 1
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
if ( $g_parameter->MY_REPORT=="N" || DEBUGNOALYSS > 1) :
|
||||
?>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
||||
<FORM method="POST">
|
||||
<div class="" id="closing_div" style="display:grid">
|
||||
<h2>Clôture</h2>
|
||||
<div class="text-muted">Clôture de l'exercice pour les comptes 6 à 7</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
echo HtmlInput::array_to_hidden(["gDossier","ac"],$_REQUEST);
|
||||
echo HtmlInput::hidden("sa","closing");
|
||||
$cl_exercice = $cn->make_array("select distinct p_exercice,p_exercice_label from parm_periode order by p_exercice desc");
|
||||
$sclExercice = new ISelect("exercice_cl");
|
||||
$sclExercice->id = "select_exercice_cl_id";
|
||||
$sclExercice->value = $cl_exercice;
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="exercice_cl"><?= _("Exercice à clôturer") ?></label>
|
||||
<?php echo $sclExercice->input(); ?>
|
||||
</div>
|
||||
<?= \HtmlInput::submit("ope_submit", _("Valider")) ?>
|
||||
</FORM>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
56
include/template/operation_exercice-input_transfer.php
Normal file
56
include/template/operation_exercice-input_transfer.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?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 7/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief propose to transfer
|
||||
*/
|
||||
Noalyss\Dbg::echo_file(__FILE__);
|
||||
$cn=Dossier::connect();
|
||||
?>
|
||||
<?=HtmlInput::button_action(_("Transfert"),"$('operation_exercice_transfer_info').update();$('oe_transfer_div').show()")?>
|
||||
<div class="inner_box" id="oe_transfer_div" style="display:none;position: fixed;top:25%;overflow-scrolling: auto">
|
||||
<?= HtmlInput::title_box(_("Transfert à la comptabilité"), "oe_transfer_div") ?>
|
||||
<form method="POST" id="operation_exercice_transfer_frm" onsubmit="operation_exercice.transfer();return false;">
|
||||
<?php
|
||||
echo HtmlInput::array_to_hidden(array("ac", "gDossier"), $_REQUEST);
|
||||
echo HtmlInput::hidden("op", "operation_exercice+transfer");
|
||||
echo HtmlInput::hidden("oe_id", $this->operation_exercice_sql->oe_id);
|
||||
// show the ledger
|
||||
|
||||
$ledger = new Acc_Ledger($cn, 0);
|
||||
$wLedger = $ledger->select_ledger('ODS', 2, FALSE);
|
||||
if ($wLedger == null)
|
||||
throw new Exception(_('Pas de journal disponible'));
|
||||
|
||||
echo _("Journal destination"), $wLedger->input();
|
||||
|
||||
?>
|
||||
<div id="operation_exercice_transfer_info" ></div>
|
||||
<ul class="aligned-block">
|
||||
<li>
|
||||
<?= \HtmlInput::submit("save", _("Sauve")) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= \HtmlInput::button_hide("oe_transfer_div") ?>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
100
include/template/operation_exercice-list_draft.php
Normal file
100
include/template/operation_exercice-list_draft.php
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?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 11/01/24
|
||||
/*!
|
||||
* \file
|
||||
* \brief display draft OPERATION_EXERCICE
|
||||
*/
|
||||
$http = new HttpInput();
|
||||
$cn=Dossier::connect();
|
||||
$a_operation = $cn->get_array("select oe_id
|
||||
,to_char(oe_date,'DD.MM.YY') str_date
|
||||
,to_char(oe_transfer_date,'DD.MM.YY') str_transfer_date
|
||||
,to_char(tech_date,'DD.MM.YY HH24:MI') draft_date
|
||||
,jr_internal
|
||||
,tech_user
|
||||
,oe_text
|
||||
,oe_type
|
||||
from operation_exercice order by oe_id desc");
|
||||
|
||||
$aUrl = ["ac" => $http->request("ac"), "gDossier" => Dossier::id()];
|
||||
$checkbox=new ICheckBox("operation_list[]");
|
||||
$checkbox->set_range("operation_range");
|
||||
?>
|
||||
<form method="POST">
|
||||
<?php
|
||||
echo \HtmlInput::array_to_hidden(["gDossier", "sa"], $_REQUEST);
|
||||
echo \HtmlInput::hidden("sa", "remove");
|
||||
?>
|
||||
<table class="result">
|
||||
<tr>
|
||||
<th>
|
||||
<?= _("Date brouillon") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= _("Date opération") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= _("Description") ?>
|
||||
</th>
|
||||
<th>
|
||||
<?= _("Utilisateur") ?>
|
||||
</th>
|
||||
<th>
|
||||
|
||||
<?= _("Date transfert") ?>
|
||||
</th>
|
||||
<th><?=_("opération")?></th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($a_operation as $operation) {
|
||||
$aUrl['operation_exercice_id'] = $operation['oe_id'];
|
||||
$aUrl['sa'] = $operation['oe_type'];
|
||||
$url = NOALYSS_URL . "/do.php?" . http_build_query($aUrl);
|
||||
$checkbox->value=$operation['oe_id'];
|
||||
$detail="";
|
||||
if ( ! empty ($operation['jr_internal'])) {
|
||||
$jr_id=$cn->get_value("select jr_id from jrn where jr_internal =$1",[$operation['jr_internal']]);
|
||||
if (!empty($jr_id))
|
||||
$detail=\HtmlInput::detail_op($jr_id,$operation['jr_internal']);
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class=""><?=$operation['draft_date']?></td>
|
||||
<td class=""><?=$operation['str_date']?></td>
|
||||
<td class=""><?=$operation['oe_text']?></td>
|
||||
<td class=""><?=$operation['tech_user']?></td>
|
||||
<td class=""><?=$operation['str_transfer_date']?></td>
|
||||
<td class=""><?=$detail?></td>
|
||||
<td class=""><?=\Icon_Action::detail_anchor(uniqid(), $url)?></td>
|
||||
<td><?=$checkbox->input()?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
<?=\HtmlInput::submit("remove",_("Efface la sélection"))?>
|
||||
</form>
|
||||
<?php
|
||||
echo ICheckBox::javascript_set_range("operation_range");
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -48,9 +48,9 @@ if ( isset ($_POST["ADD"]) )
|
|||
$new_user->login=$login;
|
||||
|
||||
$new_user->email=$http->post('EMAIL',"string",'');
|
||||
if ( trim($login)=="")
|
||||
if ( trim($login)=="" || strlen($login)<5)
|
||||
{
|
||||
alert(_("Le login ne peut pas être vide"));
|
||||
alert(_("Le login ne peut pas être vide et avoir au moins 5 lettres"));
|
||||
}elseif (count($a_result['msg']) > 0){
|
||||
// password too weak
|
||||
$msg='<span class="warning">'._("Mot de passe inchangé").'</span>';
|
||||
|
|
@ -182,6 +182,7 @@ if ( isset($_REQUEST['det']) && $sbaction=="")
|
|||
<?php echo HtmlInput::title_box(_('Ajout Utilisateur'),"create_user","hide");?>
|
||||
<form action="admin-noalyss.php?action=user_mgt" method="POST" onsubmit="return check_form()">
|
||||
<div style="text-align: center">
|
||||
<span style="position:absolute;font-size:75%" id="info_passid"></span>
|
||||
<TABLE class="result" >
|
||||
<TR><TD style="text-align: right"> <?php echo _('login')?></TD><TD><INPUT id="input_login" class="input_text" TYPE="TEXT" NAME="LOGIN"></TD></tr>
|
||||
<TR><TD style="text-align: right"> <?php echo _('Prénom')?></TD><TD><INPUT class="input_text" TYPE="TEXT" NAME="FNAME"></TD></tr>
|
||||
|
|
@ -192,9 +193,9 @@ if ( isset($_REQUEST['det']) && $sbaction=="")
|
|||
|
||||
</TD>
|
||||
<TD> <INPUT id="input_password" class="input_text" TYPE="TEXT" NAME="PASS"
|
||||
onkeyup=check_password_strength('input_password','info_passid')
|
||||
onkeyup="check_password_strength('input_password','info_passid',true)"
|
||||
>
|
||||
<span id="info_passid"></span>
|
||||
|
||||
</TD></TR>
|
||||
<TR><TD style="text-align: right"> <?php echo _('Email')?></TD><TD> <INPUT class="input_text" TYPE="TEXT" NAME="EMAIL"></TD></TR>
|
||||
</TABLE>
|
||||
|
|
@ -218,8 +219,14 @@ echo HtmlInput::button_action(_("Fermer"), "$('create_user').style.display='none
|
|||
$('input_password').setStyle({border:"red solid 2px"});
|
||||
return false;
|
||||
}
|
||||
if ($F('input_login').length < 5) {
|
||||
smoke.alert('<?php echo _('Le login doit avoir au moins 5 lettres') ?>');
|
||||
$('input_password').setStyle({border:"red solid 2px"});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
|
@ -253,7 +260,7 @@ if ( !empty ($a_user) )
|
|||
{
|
||||
echo '<span style="display:block">';
|
||||
echo _('Cherche').Icon_Action::infobulle(22);
|
||||
echo HtmlInput::filter_table("user", "0,1,2,5","1");
|
||||
echo HtmlInput::filter_table("user", "0,1,2,3,5,6","1");
|
||||
echo '</span>';
|
||||
echo '<table id="user" class="result">';
|
||||
echo '<tr>';
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ $it_pass->value="";
|
|||
</td>
|
||||
<td>
|
||||
<?php echo $it_pass->input();?>
|
||||
<span id="password_info" style="background-color: yellow;color:red;position:absolute"></span>
|
||||
<span id="password_info" style="background-color: rgba(255,160,122,0.58);color:orangered;position:absolute"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ begin
|
|||
end if;
|
||||
return NEW;
|
||||
end;
|
||||
$function$
|
||||
;
|
||||
$function$;
|
||||
|
||||
drop trigger if exists fiche_detail_check_qcode_trg on public.fiche_detail ;
|
||||
drop function comptaproc.fiche_detail_qcode_upd();
|
||||
|
|
@ -38,3 +37,60 @@ update fiche_detail set ad_value=ad_value where ad_id in (select ad_id from attr
|
|||
|
||||
insert into parameter values ('MY_REPORT','N') ON CONFLICT DO NOTHING;
|
||||
|
||||
update menu_ref set me_file='payment_method.inc.php' where me_code='CFGPAY';
|
||||
|
||||
update menu_ref set me_menu='Principal' where me_code='COMPANY';
|
||||
update menu_ref set me_menu='Financier' where me_code='MENUFIN';
|
||||
|
||||
CREATE OR REPLACE FUNCTION comptaproc.set_tech_user()
|
||||
RETURNS trigger
|
||||
AS $function$
|
||||
declare
|
||||
/* variable */
|
||||
noalyss_user text;
|
||||
begin
|
||||
new.tech_user := current_setting('noalyss.user_login');
|
||||
new.tech_date := now();
|
||||
return NEW;
|
||||
|
||||
exception when others then
|
||||
new.tech_date := now();
|
||||
new.tech_user := current_user;
|
||||
return NEW;
|
||||
end ;
|
||||
$function$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
drop table if exists operation_exercice_detail;
|
||||
drop table if exists operation_exercice;
|
||||
|
||||
create table operation_exercice
|
||||
(
|
||||
oe_id bigint generated by default as identity primary key,
|
||||
oe_date date null,
|
||||
oe_type text not null check (oe_type = 'opening' or oe_type = 'closing'),
|
||||
oe_text text ,
|
||||
oe_dossier_id int not null,
|
||||
oe_exercice int not null,
|
||||
jr_internal text,
|
||||
oe_transfer_date timestamp,
|
||||
tech_user text,
|
||||
tech_date timestamp default now()
|
||||
);
|
||||
|
||||
create table operation_exercice_detail
|
||||
(
|
||||
oed_id bigint generated by default as identity primary key,
|
||||
oe_id bigint references operation_exercice (oe_id) on update cascade on delete cascade not null,
|
||||
oed_poste account_type ,
|
||||
oed_qcode text ,
|
||||
oed_label text,
|
||||
oed_amount numeric (20,4),
|
||||
oed_debit bool
|
||||
);
|
||||
|
||||
create trigger trg_set_tech_user before insert or update on operation_exercice for each row execute function comptaproc.set_tech_user();
|
||||
|
||||
update menu_ref set me_code='OPCL' , me_menu='Ouvert./Fermeture',me_file='operation_exercice.inc.php',me_description='Opération de cloture ou d''ouverture d''exercice'
|
||||
,me_description_etendue ='Ecriture d''ouverture ou de fermeture , , reporte les soldes des comptes de l''année passé du poste comptable 0xxx à 5xxxx sur l''année courante ou ferme les comptes de 6 à 7 de l''année '
|
||||
where me_code='OPEN';
|
||||
|
|
@ -702,38 +702,6 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertEquals("3,2,4,5",$ledger->get_all_fiche_def());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_saldo_exercice
|
||||
*/
|
||||
public function testGet_saldo_exercice()
|
||||
{
|
||||
$result=[
|
||||
["solde"=> 658.25 , "j_poste"=> "4400004", "j_qcode"=> "FOURNI"],
|
||||
["solde"=> 660.17 , "j_poste"=> "4000005", "j_qcode"=> "CLIENT1"],
|
||||
["solde"=> 87.8400, "j_poste"=> "4112", "j_qcode"=> ""],
|
||||
["solde"=>-114.57 , "j_poste"=> "4511", "j_qcode"=> ""],
|
||||
["solde"=> -1496.3400 , "j_poste"=>"4400005", "j_qcode"=> "FOURNI1"]
|
||||
];
|
||||
$get=$this->object->get_saldo_exercice("2018");
|
||||
$nb_get=count($get);
|
||||
$nb_result=count($result);
|
||||
$ix=0;
|
||||
for ($i=0;$i<$nb_get;$i++)
|
||||
{
|
||||
for ($e=0;$e<$nb_result;$e++) {
|
||||
if (
|
||||
$result[$e]["j_poste"] == $get[$i]["j_poste"] &&
|
||||
$result[$e]["j_qcode"] == $get[$i]["j_qcode"]
|
||||
)
|
||||
{
|
||||
$this->assertEquals($result[$e]["solde"],$get[$i]["solde"]);
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals(5,$ix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_last_date
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -222,6 +222,103 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
$this->clean_operation();
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::insert
|
||||
*/
|
||||
public function testInsertPayment()
|
||||
{
|
||||
global $g_connection;
|
||||
$array=$this->array;
|
||||
$array["mt"]="1572704002.1732";
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0);
|
||||
$array["amount_t0"]=658.25;
|
||||
$array['hplan']=array(array(-1));
|
||||
$array["val"]=array(array(658.25));
|
||||
$sql="
|
||||
from quant_purchase
|
||||
join jrnx using(j_id)
|
||||
join jrn on (jr_grpt_id=j_grpt)
|
||||
where
|
||||
jr_mt='1572704002.1732'
|
||||
and j_qcode='LOYER'
|
||||
";
|
||||
|
||||
$this->clean_operation();
|
||||
$array=array_merge($array, array("e_march1"=>"DOCUME",
|
||||
"e_march1_price"=>18.25,
|
||||
"e_quant1"=>"",
|
||||
"htva_march1"=>18.25,
|
||||
"e_march1_tva_id"=>1,
|
||||
"e_march1_tva_amount"=>22.08,
|
||||
"tva_march1"=>3.83,
|
||||
"tvac_march1"=>22.08
|
||||
,"p_currency_rate"=>1
|
||||
,"p_currency_code"=>0
|
||||
));
|
||||
|
||||
// create a payment method with a valid card
|
||||
$payment_methodSQL=$this->insert_payment_method();
|
||||
$array['mp_date'] ="";
|
||||
$array['acompte'] = 0;
|
||||
$array['e_mp'] = $payment_methodSQL->getp("mp_id");
|
||||
$array['e_mp_qcode_'.$array['e_mp']]='CDOLLAR';
|
||||
$this->object->insert($array);
|
||||
|
||||
$this->assertEquals($array['htva_march0'],$g_connection->get_value("select qp_price ".$sql));
|
||||
|
||||
// check payment
|
||||
$nQuant_FinId=$this->get_reconcilied_operation();
|
||||
|
||||
$quant_fin=new Quant_Fin_SQL($g_connection,$nQuant_FinId);
|
||||
$nQuantFin_Amount=$quant_fin->getp("qf_amount") ;
|
||||
|
||||
$this->assertTrue($nQuantFin_Amount == -658.25,"error : purchase 658.25 and payment {$nQuantFin_Amount} not equal ");
|
||||
|
||||
// check card used in bank
|
||||
$expected_bank=$g_connection->get_value("
|
||||
select jrn_def_bank
|
||||
from
|
||||
jrn_def jd1
|
||||
join payment_method pm1 on (jd1.jrn_def_id=pm1.mp_jrn_def_id)
|
||||
where mp_id=$1",[$array['e_mp']]);
|
||||
|
||||
$found_bank =$quant_fin->getp("qf_bank");
|
||||
|
||||
$this->assertTrue($expected_bank==$found_bank,"error : payment done with a wrong card {$found_bank} instead of $expected_bank");
|
||||
$payment_methodSQL->delete();
|
||||
$this->clean_operation();
|
||||
|
||||
}
|
||||
|
||||
private function insert_payment_method()
|
||||
{
|
||||
global $g_connection;
|
||||
$payment_methodSQl=new Payment_method_SQL($g_connection);
|
||||
$payment_methodSQl->from_array([
|
||||
"mp_lib"=>"caisse"
|
||||
,"mp_jrn_def_id"=>1
|
||||
,'mp_fd_id'=>3
|
||||
,"jrn_def_id"=>3
|
||||
]);
|
||||
$payment_methodSQl->insert();
|
||||
return $payment_methodSQl;
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief return the reconcilied operation of this->object
|
||||
* @return mixed|string
|
||||
* @throws Exception
|
||||
*/
|
||||
private function get_reconcilied_operation()
|
||||
{
|
||||
global $g_connection;
|
||||
$nValue=$g_connection->get_value("select jra_concerned
|
||||
from jrn_rapt where jr_id=$1",[$this->object->jr_id]);
|
||||
$nQuant_FinId=$g_connection->get_value("select qf_id from quant_fin where jr_id=$1",[$nValue]);
|
||||
return $nQuant_FinId;
|
||||
}
|
||||
/**
|
||||
* @brief set special attributes to test NOT DEDUCTIBLE : private, VAT and tax
|
||||
* @global type $g_connection
|
||||
|
|
|
|||
|
|
@ -83,8 +83,23 @@ class Acc_Ledger_SaleTest extends TestCase
|
|||
private function clean_operation()
|
||||
{
|
||||
global $g_connection;
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1", ["1572714478.3155"]);
|
||||
$mt="1572714478.3155";
|
||||
//delete reconcilied operations
|
||||
$g_connection->exec_sql("
|
||||
delete from jrn
|
||||
where jr_id in (select jr2.jr_id
|
||||
from jrn_rapt ra1 join jrn jr2 on (ra1.jr_id=jr2.jr_id)
|
||||
where jr2.jr_mt=$1)",[$mt]);
|
||||
|
||||
$g_connection->exec_sql("
|
||||
delete from jrn
|
||||
where jr_id in (select jr2.jr_id
|
||||
from jrn_rapt ra1 join jrn jr2 on (ra1.jra_concerned=jr2.jr_id)
|
||||
where jr2.jr_mt=$1)",[$mt]);
|
||||
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1", [$mt]);
|
||||
$g_connection->exec_sql("delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)");
|
||||
|
||||
$g_connection->exec_sql("alter sequence s_jrn_pj2 restart with 40");
|
||||
}
|
||||
/**
|
||||
|
|
@ -168,6 +183,78 @@ class Acc_Ledger_SaleTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sale::insert
|
||||
*/
|
||||
public function testInsertPayment()
|
||||
{
|
||||
global $g_connection;
|
||||
$this->clean_operation();
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",["1572714478.3155"]);
|
||||
$this->assertEquals(0,$cnt);
|
||||
|
||||
$sql="
|
||||
from quant_sold
|
||||
join jrnx using(j_id)
|
||||
join jrn on (jr_grpt_id=j_grpt)
|
||||
where
|
||||
jr_mt='1572714478.3155'
|
||||
and j_qcode='MARCHA'
|
||||
";
|
||||
$array=$this->array;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0, 1);
|
||||
$array["amount_t0"]=24.2;
|
||||
$array["hplan"]=array(array(-1), array(-1));
|
||||
$array["val"]=array(array(24, 2), array(1212.5));
|
||||
$array["mt"]="1572714478.3155";
|
||||
|
||||
// create a payment method with a valid card
|
||||
$array['mp_date'] ="";
|
||||
$array['acompte'] = 0;
|
||||
$array['e_mp'] = 1;
|
||||
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals($array['htva_march1'],$g_connection->get_value("select qs_price ".$sql));
|
||||
|
||||
// check payment
|
||||
$nQuant_FinId=$this->get_reconcilied_operation();
|
||||
|
||||
$quant_fin=new Quant_Fin_SQL($g_connection,$nQuant_FinId);
|
||||
$nQuantFin_Amount=$quant_fin->getp("qf_amount") ;
|
||||
|
||||
$this->assertTrue($nQuantFin_Amount ==bcadd( $array['tvac_march1'],$array['tvac_march0']),"error : sale {$array['tvac_march1']} and payment {$nQuantFin_Amount} not equal ");
|
||||
|
||||
// check card used in bank
|
||||
$expected_bank=$g_connection->get_value("
|
||||
select jrn_def_bank
|
||||
from
|
||||
jrn_def jd1
|
||||
join payment_method pm1 on (jd1.jrn_def_id=pm1.mp_jrn_def_id)
|
||||
where mp_id=$1",[$array['e_mp']]);
|
||||
|
||||
$found_bank =$quant_fin->getp("qf_bank");
|
||||
|
||||
$this->assertTrue($expected_bank==$found_bank,"error : payment done with a wrong card {$found_bank} instead of $expected_bank");
|
||||
|
||||
$this->clean_operation();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief return the reconcilied operation of this->object
|
||||
* @return mixed|string
|
||||
* @throws Exception
|
||||
*/
|
||||
private function get_reconcilied_operation()
|
||||
{
|
||||
global $g_connection;
|
||||
$nValue=$g_connection->get_value("select jra_concerned
|
||||
from jrn_rapt where jr_id=$1",[$this->object->jr_id]);
|
||||
$nQuant_FinId=$g_connection->get_value("select qf_id from quant_fin where jr_id=$1",[$nValue]);
|
||||
return $nQuant_FinId;
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_Sale::confirm
|
||||
*/
|
||||
|
|
@ -240,4 +327,5 @@ class Acc_Ledger_SaleTest extends TestCase
|
|||
$ret=$this->object->get_detail_sale(92,103,'unpaid');
|
||||
$this->assertEquals(5,Database::num_row($ret),'only unpaid operations');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class Noalyss_Parameter_FolderTest extends TestCase
|
|||
"MY_ALPHANUM,".
|
||||
"MY_UPDLAB,".
|
||||
"MY_ANC_FILTER,".
|
||||
"MY_REPORT,".
|
||||
"MY_STOCK");
|
||||
|
||||
}
|
||||
209
unit-test/include/class/operation_exerciceTest.php
Normal file
209
unit-test/include/class/operation_exerciceTest.php
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* * Copyright (C) 2022 Dany De Bontridder <dany@alchimerys.be>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*
|
||||
* Author : Dany De Bontridder danydb@noalyss.eu $(DATE)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief noalyss
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require DIRTEST . '/global.php';
|
||||
|
||||
/**
|
||||
* @testdox Test Operation_Exercice, Operation_Opening and Operation_Closing
|
||||
* @coversDefaultClass
|
||||
*/
|
||||
class Operation_ExerciceTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Fiche
|
||||
*/
|
||||
protected $object;
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test method is executed.
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test method is executed.
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
/**
|
||||
* example
|
||||
* if ( ! is_object($this->object->fiche_def)) return;
|
||||
* include_once DIRTEST.'/global.php';
|
||||
* $g_connection=Dossier::connect();
|
||||
* $sql=new ArrayObject();
|
||||
* $sql->append("delete from fiche_detail where f_id in (select f_id from fiche where fd_id =\$1 )");
|
||||
* $sql->append("delete from fiche where f_id not in (select f_id from fiche_detail where \$1=\$1)");
|
||||
* $sql->append("delete from jnt_fic_attr where fd_id = \$1 ");
|
||||
* $sql->append("delete from fiche_def where fd_id = \$1");
|
||||
* foreach ($sql as $s) {
|
||||
* $g_connection->exec_sql($s,[$this->object->fiche_def->id]);
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* the setUpBeforeClass() template methods is called before the first test of the test case
|
||||
* class is run
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
// include 'global.php';
|
||||
global $aOperation;
|
||||
$aOperation=array();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDownAfterClass() template methods is calleafter the last test of the test case class is run,
|
||||
*
|
||||
*/
|
||||
static function tearDownAfterClass(): void
|
||||
{
|
||||
global $g_connection;
|
||||
global $aOperation;
|
||||
|
||||
// clean operation
|
||||
if (!empty($aOperation)) {
|
||||
foreach ($aOperation as $item) {
|
||||
$g_connection->exec_sql("delete from operation_exercice where oe_id=$1",[$item]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// public function dataExample()
|
||||
// {
|
||||
// return array([1], [2], [3]);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @testdox insert row for opening
|
||||
* @covers Operation_Opening::insert
|
||||
*/
|
||||
function testInsertOpening()
|
||||
{
|
||||
global $g_connection;
|
||||
global $aOperation;
|
||||
$operation=new \Operation_Opening(-1);
|
||||
$operation->set_exercice(2020);
|
||||
$operation->set_from_folder(DOSSIER);
|
||||
$operation->insert();
|
||||
$operation_id=$operation->get_operation_exercice_sql()->getp("oe_id");
|
||||
$this->assertFalse(empty($operation_id),'operation not saved');
|
||||
$aOperation[]=$operation_id;
|
||||
$sum_cred=$g_connection->get_value("select sum(oed_amount)
|
||||
from operation_exercice_detail where oed_debit='f' and oe_id=$1",[$operation_id]);
|
||||
$this->assertEquals(1796.89,$sum_cred,'Total credit incorrect for operation $operation_id');
|
||||
|
||||
$sum_deb=$g_connection->get_value("select sum(oed_amount)
|
||||
from operation_exercice_detail where oed_debit='t' and oe_id=$1",[$operation_id]);
|
||||
$this->assertEquals(1117.08,$sum_deb,'Total debit incorrect for operation $operation_id');
|
||||
|
||||
$sum=$g_connection->get_value("select sum(oed_amount)
|
||||
from operation_exercice_detail where oe_id=$1",[$operation_id]);
|
||||
$this->assertEquals(2913.97,$sum,'Total incorrect for operation $operation_id');
|
||||
|
||||
$g_connection->exec_sql("insert into operation_exercice_detail(oe_id,oed_poste,oed_amount,oed_debit)
|
||||
values ($1,$2,$3,$4)",[$operation_id,'4111',$sum_cred-$sum_deb,'t']);
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox insert row for closing
|
||||
* @covers Operation_Closing::insert
|
||||
*/
|
||||
|
||||
function testInsertClosing()
|
||||
{
|
||||
global $g_connection;
|
||||
global $aOperation;
|
||||
|
||||
$operation=new \Operation_Closing(-1);
|
||||
$operation->set_exercice(2020);
|
||||
$operation->insert();
|
||||
$operation_id=$operation->get_operation_exercice_sql()->getp("oe_id");
|
||||
$this->assertFalse(empty($operation_id),'operation not saved');
|
||||
$aOperation[]=$operation_id;
|
||||
$sum_cred=$g_connection->get_value("select sum(oed_amount)
|
||||
from operation_exercice_detail where oed_debit='f' and oe_id=$1",[$operation_id]);
|
||||
$this->assertEquals(813.08,$sum_cred,'Total credit incorrect for operation $operation_id');
|
||||
|
||||
$sum_deb=$g_connection->get_value("select sum(oed_amount)
|
||||
from operation_exercice_detail where oed_debit='t' and oe_id=$1",[$operation_id]);
|
||||
$this->assertEquals(1492.89,$sum_deb,'Total debit incorrect for operation $operation_id');
|
||||
|
||||
$sum=$g_connection->get_value("select sum(oed_amount)
|
||||
from operation_exercice_detail where oe_id=$1",[$operation_id]);
|
||||
$this->assertEquals(2305.97,$sum,'Total incorrect for operation $operation_id');
|
||||
$g_connection->exec_sql("insert into operation_exercice_detail(oe_id,oed_poste,oed_amount,oed_debit)
|
||||
values ($1,$2,$3,$4)",[$operation_id,'140',$sum_cred-$sum_deb,'t']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox transform into an array for Acc_ledger
|
||||
* @depends testInsertClosing
|
||||
* @depends testInsertOpening
|
||||
* @return void
|
||||
*/
|
||||
function testTransformOpening()
|
||||
{
|
||||
global $g_connection;
|
||||
global $aOperation;
|
||||
$ledger_id=4;
|
||||
|
||||
// clean operation
|
||||
if (!empty($aOperation)) {
|
||||
foreach ($aOperation as $item) {
|
||||
$operation_sql=new \Operation_Exercice_SQL($g_connection,$item);
|
||||
if ( $operation_sql->getp('oe_type')=='opening') {
|
||||
global $oe_data;
|
||||
$operation=new \Operation_Opening($item);
|
||||
$operation->transform($ledger_id);
|
||||
$this->assertEquals(12,$oe_data['nb_item'],"Number of elements not correct");
|
||||
}
|
||||
if ( $operation_sql->getp('oe_type')=='closing') {
|
||||
global $oe_data;
|
||||
$operation=new \Operation_Closing($item);
|
||||
$operation->transform($ledger_id);
|
||||
$this->assertEquals(5,$oe_data['nb_item'],"Number of elements not correct");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -124,8 +124,8 @@ EOF;
|
|||
$pdf_anc_acc=new PDF_Anc_Acc_List($anc_acc_list);
|
||||
$pdf_anc_acc->export_pdf()->Output(__DIR__."/file/pdf_anc_acc_list-card-activity.pdf","F");
|
||||
$filesize=filesize(__DIR__."/file/pdf_anc_acc_list-card-activity.pdf");
|
||||
$this->assertTrue($filesize==77276,
|
||||
__DIR__."/file/pdf_anc_acc_list-card-activity.pdf incorrect");
|
||||
$this->assertTrue($filesize >= 77276 && $filesize <= 77287,
|
||||
__DIR__."/file/pdf_anc_acc_list-card-activity.pdf $filesize incorrect");
|
||||
|
||||
// By Account / Activity
|
||||
$anc_acc_list=new Anc_Acc_List($g_connection);
|
||||
|
|
|
|||
187
unit-test/include/class/sendmailTest.php
Normal file
187
unit-test/include/class/sendmailTest.php
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* * Copyright (C) 2022 Dany De Bontridder <dany@alchimerys.be>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*
|
||||
* Author : Dany De Bontridder danydb@noalyss.eu $(DATE)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief noalyss
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require DIRTEST . '/global.php';
|
||||
|
||||
define ("ALLOWED_EMAIL_DOMAIN","linux.org,localhost");
|
||||
|
||||
/**
|
||||
* @testdox Class SendmailTest : used for ...
|
||||
* @backupGlobals enabled
|
||||
* @coversDefaultClass Sendmail
|
||||
*/
|
||||
class SendmailTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @testdox verify that email has the mandatory filed
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyCorrect()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("dany@gmail.com");
|
||||
$sendmail->set_from("web@localhost");
|
||||
$sendmail->set_subject("Test envoi");
|
||||
$sendmail->set_message("corps du message");
|
||||
try {
|
||||
$sendmail->verify();
|
||||
$this->assertTrue(true);
|
||||
} catch (\Exception $e) {
|
||||
$this->assertTrue(false," check email fails");
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox verify that email fails it mailto is absent
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyFailsMailto()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("");
|
||||
$sendmail->set_from("web@localhost");
|
||||
$sendmail->set_subject("Test envoi");
|
||||
$sendmail->set_message("corps du message");
|
||||
$this->expectExceptionCode(EXC_INVALID);
|
||||
$sendmail->verify();
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox verify that email fails it recipient is absent
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyFailsFrom()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("web@localhost");
|
||||
$sendmail->set_from("");
|
||||
$sendmail->set_subject("Test envoi");
|
||||
$sendmail->set_message("corps du message");
|
||||
$this->expectExceptionCode(EXC_INVALID);
|
||||
$sendmail->verify();
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox verify that email fails it subject is absent
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyFailsSubject()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("web@localhost");
|
||||
$sendmail->set_from("dany@gmail.com");
|
||||
$sendmail->set_message("corps du message");
|
||||
$this->expectExceptionCode(EXC_INVALID);
|
||||
$sendmail->verify();
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox verify that email fails it content is absent
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyFailsContent()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("");
|
||||
$sendmail->set_from("web@localhost");
|
||||
$sendmail->set_subject("Test envoi");
|
||||
$this->expectExceptionCode(EXC_INVALID);
|
||||
$sendmail->verify();
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox Check that the from of email respect Domain : domain allowed
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyDomainFails()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("web@localhost");
|
||||
$sendmail->set_from("dany@gmail.com");
|
||||
$sendmail->set_subject("Test envoi");
|
||||
$sendmail->set_message("corps du message");
|
||||
|
||||
$this->expectExceptionCode(EXC_INVALID);
|
||||
$sendmail->verify();
|
||||
|
||||
}
|
||||
/**
|
||||
* @testdox Check that the from of email respect Domain : domain forbidden
|
||||
* @covers Sendmail::verify
|
||||
* @backupGlobals enabled
|
||||
*/
|
||||
function testVerifyDomainSuccess()
|
||||
{
|
||||
$sendmail=new \Sendmail();
|
||||
$sendmail->mailto("web@localhost");
|
||||
$sendmail->set_from("dany@linux.org");
|
||||
$sendmail->set_subject("Test envoi");
|
||||
$sendmail->set_message("corps du message");
|
||||
|
||||
$sendmail->verify();
|
||||
$this->assertTrue(true);
|
||||
|
||||
}
|
||||
/*
|
||||
*@testdox test increment email
|
||||
*@covers Sendmail::increment_mail Sendmail::get_email_sent
|
||||
*/
|
||||
function testIncrement_mail()
|
||||
{
|
||||
$cn=new \Database();
|
||||
$dos_id=DOSSIER;
|
||||
$sendmail=new Sendmail();
|
||||
$cn->exec_sql("delete from dossier_sent_email where dos_id=$dos_id and de_date='20100101'");
|
||||
$email_sent=$sendmail->get_email_sent($cn, $dos_id, '20100101');
|
||||
$this->assertTrue($email_sent == 0,"error cannot count email get $email_sent");
|
||||
|
||||
$sendmail->increment_mail($cn, $dos_id, "20100101");
|
||||
$email_sent=$sendmail->get_email_sent($cn, $dos_id, '20100101');
|
||||
$this->assertTrue($email_sent == 1,"error cannot count email get $email_sent");
|
||||
|
||||
$sendmail->increment_mail($cn, $dos_id, "20100101");
|
||||
$email_sent=$sendmail->get_email_sent($cn, $dos_id, '20100101');
|
||||
$this->assertTrue($email_sent == 2,"error cannot count email");
|
||||
|
||||
$sendmail->increment_mail($cn, $dos_id, "20100101");
|
||||
$email_sent=$sendmail->get_email_sent($cn, $dos_id, '20100101');
|
||||
$this->assertTrue($email_sent == 3,"error cannot count email $email_sent");
|
||||
|
||||
$cn->exec_sql("delete from dossier_sent_email where dos_id=$dos_id and de_date='20100101'");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,8 @@ use PHPUnit\Framework\TestCase;
|
|||
*/
|
||||
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
require_once DIRTEST."/global.php";
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
|
|
@ -40,6 +42,7 @@ class Tax_SummaryTest extends TestCase
|
|||
protected function setUp():void
|
||||
{
|
||||
global $g_connection;
|
||||
$g_connection=Dossier::connect();
|
||||
$this->object=new \Tax_Summary($g_connection, "01.01.2014", "31.12.2019");
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +73,8 @@ class Tax_SummaryTest extends TestCase
|
|||
|
||||
function testDisplay()
|
||||
{
|
||||
global $g_connection,$g_user;
|
||||
$g_user=new Noalyss_user($g_connection);
|
||||
$this->expectOutputRegex("/.*0,00.*\<\/tr\>\<\/table\>\n/");
|
||||
$this->object->display();
|
||||
}
|
||||
|
|
@ -155,6 +160,9 @@ class Tax_SummaryTest extends TestCase
|
|||
}
|
||||
function testGet_row_purchase()
|
||||
{
|
||||
global $g_connection,$g_user;
|
||||
$g_user=new Noalyss_user($g_connection);
|
||||
|
||||
// Operation date
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_row_purchase();
|
||||
|
|
@ -185,7 +193,10 @@ class Tax_SummaryTest extends TestCase
|
|||
|
||||
function testGet_row_sale()
|
||||
{
|
||||
$this->object->set_tva_type("O");
|
||||
global $g_connection,$g_user;
|
||||
$g_user=new Noalyss_user($g_connection);
|
||||
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_row_sale();
|
||||
//-- For creating the array
|
||||
Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_sale_o.txt", var_export($array, TRUE));
|
||||
|
|
@ -212,7 +223,10 @@ class Tax_SummaryTest extends TestCase
|
|||
|
||||
function testget_summary_purchase()
|
||||
{
|
||||
$this->object->set_tva_type("T");
|
||||
global $g_connection,$g_user;
|
||||
$g_user=new Noalyss_user($g_connection);
|
||||
|
||||
$this->object->set_tva_type("T");
|
||||
$array=$this->object->get_summary_purchase();
|
||||
//-- For creating the array
|
||||
Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getsummary_purchase_t.txt", var_export($array, TRUE));
|
||||
|
|
@ -238,6 +252,9 @@ class Tax_SummaryTest extends TestCase
|
|||
|
||||
function testget_summary_sale()
|
||||
{
|
||||
global $g_connection,$g_user;
|
||||
$g_user=new Noalyss_user($g_connection);
|
||||
|
||||
$this->object->set_tva_type("O");
|
||||
$array=$this->object->get_summary_sale();
|
||||
//-- For creating the array
|
||||
Loading…
Add table
Add a link
Reference in a new issue