Merge branch 'dev7220' into entreprise

This commit is contained in:
Dany De Bontridder 2020-04-04 14:04:17 +02:00
commit f65faea43a
27 changed files with 866 additions and 98 deletions

View file

@ -352,8 +352,8 @@ if (!defined('PHP_VERSION_ID')) {
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
if ( PHP_VERSION_ID < 50500) {
echo $g_failed. " ".phpversion." ". _("Version PHP trop basse , minimum 5.4");
if ( PHP_VERSION_ID < 70033) {
echo $g_failed. " ".phpversion." ". _("Version PHP trop basse , minimum 7.0.33");
} else {
echo $g_succeed. " ".phpversion();
@ -456,10 +456,10 @@ $version=$cn->get_value($sql);
echo _("Version base de données :"),$version;
$majeur=explode(".",$version);
if ( $majeur[0] < 9 )
if ( $majeur[0] < 9 && $majeur[0] < 5 )
{
?>
<p><?php echo $failed . _(" Vous devez absolument utiliser au minimum une version 9.0 de PostGresql, si votre distribution n'en
<p><?php echo $failed . _(" Vous devez absolument utiliser au minimum une version 9.5 de PostGresql, si votre distribution n'en
offre pas, installez-en une en la compilant. Lisez attentivement la notice sur postgresql.org pour migrer
vos bases de données")?>
</p>

View file

@ -346,6 +346,22 @@ function ledger_fin_add_row()
nb.value++;
}
/**
* Add multiple row
* @param p_numrow
*/
function ledger_add_multiple(p_elid)
{
var nbrow=$(p_elid).value;
if (nbrow == NaN) {nbrow=1;}
var type_ledger=$(p_elid+"_ledger").value;
var i=0;
for (i=0;i<nbrow;i++) {
if ( type_ledger == 'O' ) {ledger_add_row();}
if ( type_ledger == 'F') { ledger_fin_add_row();}
if ( type_ledger == 'M') { quick_writing_add_row();}
}
}
/**
* add a line in the form for the purchase ledger
* @param p_dossier folder id

View file

@ -730,6 +730,7 @@ function save_card(obj)
smoke.alert('Poste comptable trop grand');
return false;
}
// Data must be taken here
var data=$('save_card').serialize(false);
@ -896,6 +897,7 @@ function update_card(obj)
{
try {
var name=obj.id;
var qs=Form.serialize(name)+'&op2=upc&op=card';
var action=new Ajax.Request ( 'ajax_misc.php',
{

View file

@ -1230,9 +1230,7 @@ function mod_predf_op(dossier_id, od_id)
{
var target = "mod_predf_op";
removeDiv(target);
var sx = '20%';
var sy = '10%';
var str_style = "top:" + sx + ";left:" + sy + ";";
var str_style = "top:10%;left:2%;width:96%";
var div = {id: target, cssclass: 'inner_box', style: str_style, html: loading(), drag: 1};
@ -1402,6 +1400,20 @@ function set_reconcile(obj)
if (tiers && tiers.value != "") {
$(tiers.value).value = elmt.value;
/* set the name */
new Ajax.Request("fid.php",{
method:"get",
parameters:{gDossier:obj.elements['gDossier'].value,"FID":elmt.value},
onSuccess:function(req){
// find the row number
//tiers.value = e_othern
var tiers_card=new String(tiers.value);
var num=tiers_card.replace("e_other","");
var tiers_name_id="e_other"+"_name"+num;
var answer = req.responseText.evalJSON();
$(tiers_name_id).value=answer["name"];
}
});
}
}
$(ctlc.value).value += nValue;

View file

@ -2316,4 +2316,114 @@ span.warning {
background-color: #eddadd;
padding:10px;
border:red solid 1px;
}
/**********************************************************************************************************************/
/* LI as list
* Tabs like row
****************************************************************************/
ul.tab_row {
padding-top: 15px;
display:block;
width:96%;
padding-left:2%;
padding-right:2%;
list-style: none;
margin-left:2px;
}
ul.tab_row a {
display:block;
width:100%;
}
li.tab_row_selected {
display:block;
width:90%;
background: #C2E3FC; /* Old browsers */
background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* IE10+ */
background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */
color:whitesmoke;
margin-left: 2px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
font-weight: bold;
padding:5px;
margin-top:13px;
}
li.tab_row {
display:block;
width:90%;
background-color: inherit;
color:inherit;/*! margin-left: 0px; */
/*! padding: 5px; */
/*! border-top-left-radius: 10px; */
/*! border-top-right-radius: 10px; */
border:1px #879ed4 solid;
background: whitesmoke;
margin-top:13px;
}
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;margin-left: 2px;
padding: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
white-space: nowrap;
}
@media only screen and (min-width: 1280px) {
li.tab_row {
display:block;
background-color: inherit;
padding: 15px 7px 0px 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
}
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;margin-left: 2px;
padding: 15px 7px 0px 10px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border:1px #879ed4 solid;
}
li.tab_row_selected {
padding: 12px 15px 15px 15px;
}
}
ul.tab_row a {
text-decoration: none;
color:inherit;
display:block;
white-space: nowrap;
width: 100%;
height: 100%;
cursor :pointer;
}
ul.tab_row a:hover {
text-decoration: none;
color:white;
display:block;
background-color: lightblue;
}
span.tab_row {
font-style: italic;
font-size:90%;
}
span.title_tab_row {
}

View file

@ -55,7 +55,6 @@ input:focus {
font-style: italic;
}
a.mtitle span.notice {
text-decoration: underline;
}
@ -2327,4 +2326,143 @@ span.warning {
font-weight: bold;
background-color: #eddadd;
padding:10px;
}
/**********************************************************************************************************************/
/* LI as list
* Tabs like row
****************************************************************************/
ul.tab_row {
padding-top: 25px;
display:block;
width:100%;
padding-left:0%;
padding-right:0%;
list-style: none;
margin-left:0px;
}
ul.tab_row a {
display:block;
width:100%;
}
li.tab_row_selected {
display:block;
width:96%;
background: #C2E3FC; /* Old browsers */
background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* IE10+ */
background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */
color:whitesmoke;
/*! margin-left: 2px; */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
font-weight: bold;
padding:5px;
margin-top:13px;
padding-left: 2%;
padding-right: 2%;
}
li.tab_row {
display:block;
width:auto;
background-color: inherit;
color:inherit;/*! margin-left: 0px; */
padding: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
background: whitesmoke;
margin-top:13px;
}
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;margin-left: 2px;
padding: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
white-space: nowrap;
}
@media only screen and (min-width: 1280px) {
li.tab_row {
display:block;
background-color: inherit;
padding: 20px 15px 15px 20px;
margin: 20px 15px 15px 15px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
}
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;margin-left: 2px;
padding: 20px 15px 15px 20px;
margin: 20px 15px 15px 15px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border:1px #879ed4 solid;
}
li.tab_row_selected {
padding: 20px 15px 15px 20px;
margin:20px 15px 15px 15px;
}
}
ul.tab_row a {
text-decoration: none;
color:inherit;
display:block;
white-space: nowrap;
width: 100%;
height: 100%;
cursor :pointer;
text-align: center;
}
ul.tab_row a:hover {
text-decoration: none;
color:white;
display:block;
background-color: lightblue;
/*! text-align: center; */
}
div.tab_row {
background-color: aliceblue;
border-color: #879ed4;
border-width: 1px;
border-style: solid;
}
span.tab_row {
font-style: italic;
font-size:90%;
}
span.title_tab_row {
font-size:105%;
font-weight: bold;
background-color: darkblue;
color:white;
padding : 3px;
}
span.tab_row {
font-style: italic;
font-size:90%;
}
span.title_tab_row {
font-size:105%;
font-weight: bold;
background-color: darkblue;
color:white;
padding : 3px;
}

View file

@ -2241,4 +2241,122 @@ span.warning {
font-weight: bold;
background-color: #eddadd;
padding:10px;
}
/**********************************************************************************************************************/
/* LI as list
* Tabs like row
****************************************************************************/
ul.tab_row {
padding-top: 15px;
display:block;
width:96%;
padding-left:2%;
padding-right:2%;
list-style: none;
margin-left:2px;
}
ul.tab_row a {
display:block;
width:100%;
}
li.tab_row_selected {
display:block;
width:90%;
background: #C2E3FC; /* Old browsers */
background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* IE10+ */
background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */
color:whitesmoke;
margin-left: 2px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
font-weight: bold;
padding:5px;
margin-top:13px;
}
li.tab_row {
display:block;
width:90%;
background-color: inherit;
color:inherit;/*! margin-left: 0px; */
/*! padding: 5px; */
/*! border-top-left-radius: 10px; */
/*! border-top-right-radius: 10px; */
border:1px #879ed4 solid;
background: whitesmoke;
margin-top:13px;
padding:5px;
}
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;margin-left: 2px;
padding: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
white-space: nowrap;
}
@media only screen and (min-width: 1280px) {
li.tab_row {
display:block;
background-color: inherit;
padding: 15px 7px 15px 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border:1px #879ed4 solid;
}
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;margin-left: 2px;
padding: 15px 7px 0px 10px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border:1px #879ed4 solid;
}
li.tab_row_selected {
padding: 12px 15px 15px 15px;
}
}
ul.tab_row a {
text-decoration: none;
color:inherit;
display:block;
white-space: nowrap;
width: 100%;
height: 100%;
cursor :pointer;
padding: 3px;
}
ul.tab_row a:hover {
text-decoration: none;
color:white;
display:block;
background-color: lightblue;
}
span.tab_row {
font-style: italic;
font-size:90%;
}
span.title_tab_row {
font-size:105%;
font-weight: bold;
background-color: darkblue;
color:white;
padding : 3px;
}

View file

@ -96,6 +96,7 @@ $html=var_export($_REQUEST,true);
// For storing extra information , example the HTML elt id to update
// after creating
$extra="";
$http=new \HttpInput();
switch($op2)
{
/* ------------------------------------------------------------ */
@ -103,12 +104,11 @@ switch($op2)
/* ------------------------------------------------------------ */
case 'rmfa':
if ($g_user->check_action(FICCAT)==0)exit();
ob_start();
if( ! isset($_GET['ad_id']) || isNumber($_GET['ad_id']) ==0)
throw new Exception ( _("Parametre ad_id est invalide"),11);
$ad_id= $_GET['ad_id'];
ob_start();
try
{
$ad_id= $http->get("ad_id","number");
$cn->start();
$fa=new Fiche_Attr($cn,$ad_id);
$fa->delete();
@ -117,6 +117,7 @@ case 'rmfa':
catch (Exception $e)
{
$cn->rollback();
record_log($e->getMessage());
record_log($e->getTraceAsString());
echo $e->getMessage();
}

View file

@ -273,11 +273,10 @@ class Acc_Balance
// Add the saldo
$i+=1;
$delta=bcsub($tot_deb,$tot_cred);
$side_delta=($delta<0)?"C":"D";
$side_delta=($delta==0)?"=":$side_delta;
$side_delta=findSide($delta);
$a['poste']="";
$a['label']="Totaux ".nbm(abs($delta)).$side_delta;
$a['label']=sprintf(_("Totaux %s %s"),nbm(abs($delta)),$side_delta);
$a['sum_deb']=$tot_deb;
$a['sum_cred']=$tot_cred;
$a['solde_deb']=$tot_deb_saldo;

View file

@ -50,6 +50,7 @@ require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_currency.class.php';
require_once NOALYSS_INCLUDE.'/database/operation_currency_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/pre_op_ods.class.php';
require_once NOALYSS_INCLUDE.'/class/html_input_noalyss.class.php';
/** \file
* @brief Class for jrn, class acc_ledger for manipulating the ledger

View file

@ -1443,7 +1443,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
// Set correctly the REQUEST param for jrn_type
$r.= HtmlInput::hidden('jrn_type','ACH');
$r.= HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"');
$r.= Html_Input_Noalyss::ledger_add_item("O");

View file

@ -1508,8 +1508,7 @@ EOF;
// Set correctly the REQUEST param for jrn_type
$r.=HtmlInput::hidden('jrn_type', 'VEN');
$r.=HtmlInput::button('add_item', _('Ajout article'), ' onClick="ledger_add_row()"');
$r.= Html_Input_Noalyss::ledger_add_item("O");
$r.= create_script("$('" . $Date->id . "').focus()");
return $r;
}

View file

@ -62,21 +62,24 @@ class Acc_Plan_MTable extends Manage_Table_SQL
["label"=>_("Produit inversé"),"value"=>"PROINV"],
["label"=>_("Contexte"),"value"=>"CON"]
]);
$this->set_col_type("pcm_direct_use", "select",array(["label"=>_("Oui"),"value"=>"Y"],["label"=>"Non","value"=>"N"]));
$this->a_order=["pcm_val","pcm_lib","parent_accounting","pcm_direct_use","pcm_type","fiche_qcode"];
$this->set_col_type("pcm_direct_use", "select",
array(["label" => _("Oui"), "value" => "Y"], ["label" => "Non", "value" => "N"]));
$this->set_col_type("pcm_val", "custom");
$this->a_order = ["pcm_val", "pcm_lib", "parent_accounting", "pcm_direct_use", "pcm_type", "fiche_qcode"];
$this->set_icon_mod("first");
}
/**
* Display a row
* @param type $p_row array of value key column=>value
*/
function display_row($p_row)
{
printf('<tr id="%s_%s">',
printf('<tr id="%s_%s">',
$this->object_name,
$p_row[$this->table->primary_key])
;
$dossier_id=Dossier::id();
$nb_order=count($this->a_order);
for ($i=0; $i<$nb_order; $i++)
@ -99,29 +102,29 @@ class Acc_Plan_MTable extends Manage_Table_SQL
elseif ($v == "fiche_qcode") {
$count=$this->table->cn->get_value("select count(*) from fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val']));
if ($count == 0) echo td("");
elseif ($count == 1 ) {
elseif ($count == 1 ) {
echo '<td>';
echo HtmlInput::card_detail($p_row[$v]) ;
echo HtmlInput::card_detail($p_row[$v]) ;
echo '</td>';
}
elseif ($count > 1) {
elseif ($count > 1) {
echo '<td>';
$a_code=explode(",",$p_row[$v]);
$nb_code=count($a_code);
for ($xx = 0;$xx < $nb_code;$xx++)
{
echo HtmlInput::card_detail($a_code[$xx])."," ;
echo HtmlInput::card_detail($a_code[$xx])."," ;
}
echo " ($count) ";
echo Icon_Action::more(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"]));
echo '</td>';
}
}
}
elseif ($v=="pcm_lib")
{
if ( $nb >0){
echo "<td>";
if ($nb_used > 0) {
@ -148,13 +151,14 @@ class Acc_Plan_MTable extends Manage_Table_SQL
echo '</tr>';
}
/**
* Check that the entered data are valid before recording them into
* Check that the entered data are valid before recording them into
* tmp_pcmn, the errors are stored into this->a_error and if someting wrong
* is found it returns false, if the data can be saved it returns true
* @return return false if an error is found,
* @return return false if an error is found,
*/
function check()
function check()
{
$cn=Dossier::connect();
$count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1 and id <> $2",
@ -180,12 +184,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL
if ($exist_parent == 0) {
$this->set_error("parent_accounting", _("Compte parent n'existe pas"));
}
if ( count($this->aerror) > 0 ) return false;
/**
* check that accounting is not already used
*/
$old_accounting = $cn->get_value("select pcm_val from tmp_pcmn where id = $1",
array($this->table->id));
// it is not a new accounting and is different
if ($old_accounting != "" && $old_accounting != $this->table->pcm_val) {
// count it is used
if ($cn->get_value("select count(*) from jrnx where j_poste=$1",
[$old_accounting]) > 0) {
$this->set_error("pcm_val", _("Poste utilisé"));
}
}
if (count($this->aerror) > 0) return false;
return true;
}
/**
* @brief display into a dialog box the datarow in order
* @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need
* a more complex form
*/
@ -195,5 +212,31 @@ class Acc_Plan_MTable extends Manage_Table_SQL
$dossier_id=Dossier::id();
echo HtmlInput::button_action(_("Toutes les fiches") , sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val));
}
/**
* if pcm_val already used then it cannot be modified
*
* @param $p_key always pcm_val
* @param $p_value current value of pcm_val
* @return nothing|void
*/
function input_custom($p_key, $p_value)
{
$readonly=true;
$cn=Dossier::connect();
if (
$p_value == "" ||
($p_value !="" && $cn->get_value("select count(*) from jrnx where j_poste=$1",[$p_value]) == 0 )
)
{
$readonly=false;
}
$text=new IText($p_key);
$text->setReadOnly($readonly);
$text->value=$p_value;
$min_size=(strlen($p_value)<30)?30:strlen($p_value)+5;
$text->size=$min_size;
echo $text->input();
}
}

View file

@ -530,10 +530,18 @@ class Fiche
$w->name = "av_text" . $attr->ad_id;
if ($attr->ad_id == 21 || $attr->ad_id==22||$attr->ad_id==20||$attr->ad_id==31)
{
$bulle=Icon_Action::infobulle(21);
$bulle=Icon_Action::infobulle( 21);
}
if ($attr->ad_id == ATTR_DEF_NAME || $attr->ad_id== ATTR_DEF_QUICKCODE)
// Warning length quickcode
if ($attr->ad_id== ATTR_DEF_QUICKCODE ) {
$bulle=Icon_Action::warnbulle(76);
}
if ($attr->ad_id == ATTR_DEF_NAME || $attr->ad_id== ATTR_DEF_QUICKCODE)
{
$class=" input_text highlight info";
}
else
$class="input_text";
$r.="<TR>" . td(_($w->label)." $bulle", ' class="'.$class.'" ') . td($w->input()." $msg")." </TR>";
@ -721,6 +729,10 @@ class Fiche
else
$class="input_text";
// Warning length quickcode
if ($r->ad_id== ATTR_DEF_QUICKCODE ) {
$bulle=Icon_Action::warnbulle(76);
}
$ret.="<TR>".td(_($r->ad_text).$bulle,'class="'.$class.'"').td($w->input()." ".$msg)." </TR>";
}

View file

@ -0,0 +1,61 @@
<?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
* 1/03/20
*/
/**
* @file
* @brief
*
*/
// Copyright Author Dany De Bontridder danydb@noalyss.eu
require_once NOALYSS_INCLUDE."/lib/html_input.class.php";
/**
* @class
* @brief
*
*/
class Html_Input_Noalyss extends HtmlInput
{
/**
* Build a HTML string for adding multiple rows
* @param string $p_ledger ledger type /Fin , Other = sale / purchase , M miscelleaneous
*/
static function ledger_add_item($p_ledger)
{
//Fin , Other = sale / purchase , M miscelleaneous
if ( ! in_array($p_ledger ,["F","O","M"]) ) {
throw new Exception(_("LAD46 Erreur type"));
}
$id=uniqid();
$num=new INum($id,0);
$num->value=1;
$num->size=2;
$s_js=sprintf(' onClick="ledger_add_multiple(\'%s\')"',$id);
$r=HtmlInput::hidden($id."_ledger",$p_ledger);
$r.=$num->input();
$r.=HtmlInput::button('add_item',_('ligne à ajouter'),
$s_js);
return $r;
}
}

View file

@ -40,18 +40,19 @@ class Pre_op_ach extends Pre_operation_detail
function get_post()
{
parent::get_post();
$http=new HttpInput();
$this->operation->od_direct='f';
$this->e_client=$_POST['e_client'];
$this->e_client=$http->post('e_client');
for ($i=0;$i<$this->operation->nb_item;$i++)
{
$march="e_march".$i;
$this->$march=$_POST['e_march'.$i];
$this->{"e_march".$i."_price"}=(isset ($_POST['e_march'.$i."_price"]))?$_POST['e_march'.$i."_price"]:0;
$this->{"e_march".$i."_price"}=(trim($_POST['e_march'.$i."_price"])=="")?0:$_POST['e_march'.$i."_price"];
$this->{"e_march".$i."_tva_id"}=(isset ($_POST['e_march'.$i."_tva_id"]))?$_POST['e_march'.$i."_tva_id"]:0;
$this->{"e_march".$i."_tva_amount"}=(isset($_POST['e_march'.$i."_tva_amount"]))?$_POST['e_march'.$i."_tva_amount"]:0;
$this->{"e_march".$i."_label"}=(isset($_POST['e_march'.$i."_label"]))?$_POST['e_march'.$i."_label"]:null;
$this->{"e_quant".$i}=$_POST['e_quant'.$i];
$this->$march=$http->post('e_march'.$i);
$this->{"e_march".$i."_price"}=$http->post('e_march'.$i."_price","string",0);
$this->{"e_march".$i."_price"}=$http->post('e_march'.$i."_price","string",0);
$this->{"e_march".$i."_tva_id"}=$http->post('e_march'.$i."_tva_id","string",0);
$this->{"e_march".$i."_tva_amount"}=$http->post('e_march'.$i."_tva_amount","string",0);
$this->{"e_march".$i."_label"}=$http->post('e_march'.$i."_label","string",NULL);
$this->{"e_quant".$i}=$http->post('e_quant'.$i);
}
}
@ -403,7 +404,7 @@ class Pre_op_ach extends Pre_operation_detail
// Set correctly the REQUEST param for jrn_type
$r.= HtmlInput::hidden('jrn_type','ACH');
$r.= HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"');
$r.= Html_Input_Noalyss::ledger_add_item("O");
return $r;
}

View file

@ -284,6 +284,7 @@ class Pre_Op_Advanced extends Pre_operation_detail
// If readonly == 1 then show CA
}
$ret.='</table>';
$ret.=Html_Input_Noalyss::ledger_add_item("M");
return $ret;
}
}

View file

@ -406,8 +406,8 @@ class Pre_op_ven extends Pre_operation_detail
// Set correctly the REQUEST param for jrn_type
$r.=HtmlInput::hidden('jrn_type','VEN');
$r.= Html_Input_Noalyss::ledger_add_item("O");
$r.=HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"');
return $r;
}
}

View file

@ -71,14 +71,14 @@ class Pre_operation
/*!\brief fill the object with the $_POST variable */
function get_post()
{
$this->nb_item=$_POST['nb_item'];
$this->p_jrn=$_REQUEST['p_jrn'];
$this->jrn_type=$_POST['jrn_type'];
$this->name=$_POST['opd_name'];
$http=new HttpInput();
$this->nb_item=$http->post('nb_item',"number");
$this->p_jrn=$http->request('p_jrn',"number");
$this->jrn_type=$http->post('jrn_type');
$this->name=$http->post('opd_name');
$this->name=(trim($this->name)=='')?$_POST['e_comm']:$this->name;
$this->description= $_POST['od_description'];
$this->name=(trim($this->name)=='')?$http->post('e_comm'):$this->name;
$this->description= $http->post('od_description');
if ( $this->name=="")
{
$n=$this->db->get_next_seq('op_def_op_seq');
@ -106,7 +106,7 @@ class Pre_operation
}
if ( $this->count() > MAX_PREDEFINED_OPERATION )
{
echo '<span class="notice">'.("Vous avez atteint le max. d'op&eacute;ration pr&eacute;d&eacute;finie, d&eacute;sol&eacute;").'</span>';
echo '<span class="notice">'.("Vous avez atteint le max. d'opération prédéfinie, désolé").'</span>';
return false;
}
$sql='insert into op_predef (jrn_def_id,od_name,od_item,od_jrn_type,od_direct,od_description)'.

View file

@ -149,7 +149,7 @@ try
{
echo $Ledger->input($array);
echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_fin_add_row()"');
echo Html_Input_Noalyss::ledger_add_item("F");
echo HtmlInput::submit('save',_('Sauve'));
echo HtmlInput::reset(_('Effacer'));

View file

@ -176,31 +176,32 @@ if (!empty($array)) {
if (${'lvl' . $ind . '_old'} == '') ${'lvl' . $ind . '_old'} = substr($r['poste'], 0, $ind);
if (${'lvl' . $ind . '_old'} != substr($r['poste'], 0, $ind)) {
$pdf->SetFont('DejaVu', 'B', 7);
$pdf->LongLine(30, 6, ${'lvl' . $ind . '_old'});
$strTotal=sprintf(_("Totaux %s "),${'lvl' . $ind . '_old'});
$pdf->LongLine(30, 6, $strTotal,"TB");
$delta = bcsub(${'nlvl' . $ind}['solde_cred'], ${'nlvl' . $ind}['solde_deb']);
$side = ($delta < 0) ? "D" : "C";
if ($previous == 1) {
$delta_previous = bcsub(${'nlvl' . $ind}['solde_cred_previous'], ${'nlvl' . $ind}['solde_deb_previous']);
$side_previous = ($delta_previous < 0) ? "D" : "C";
$pdf->write_cell(60, 6, " ", 0, 0, 'R');
$pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_deb_previous']), 0, 0, 'R');
$pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_cred_previous']), 0, 0, 'R');
$pdf->write_cell(22, 6, nbm(abs($delta_previous)) . " $side_previous", 0, 0, 'R');
$pdf->write_cell(60, 6, sprintf(_("niveau %s"),$ind), "TB", 0, 'R');
$pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_deb_previous']), "TB", 0, 'R');
$pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_cred_previous']), "TB", 0, 'R');
$pdf->write_cell(22, 6, nbm(abs($delta_previous)) . " $side_previous", "TB", 0, 'R');
} else {
$pdf->write_cell(60, 6, " ", 0, 0, 'R');
$pdf->write_cell(60, 6, sprintf(_("niveau %s"),$ind), "TB", 0, 'R');
}
$solde_lv = bcsub(${'nlvl' . $ind}['sum_deb_ope'], ${'nlvl' . $ind}['sum_cred_ope']);
$side_lv = ($solde_lv < 0) ? " C" : " D";
$side_lv = ($solde_lv == 0) ? " " : $side_lv;
$pdf->write_cell(25, 6, nbm(abs($solde_lv)) . $side_lv, 0, 0, 'R');
$pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_deb'], ${'nlvl' . $ind}['sum_deb_ope'])), 0, 0, 'R');
$pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_cred'], ${'nlvl' . $ind}['sum_cred_ope'])), 0, 0, 'R');
$pdf->write_cell(25, 6, nbm(abs($solde_lv)) . $side_lv, "TB", 0, 'R');
$pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_deb'], ${'nlvl' . $ind}['sum_deb_ope'])), "TB", 0, 'R');
$pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_cred'], ${'nlvl' . $ind}['sum_cred_ope'])), "TB", 0, 'R');
$solde_lv = bcsub(${'nlvl' . $ind}['solde_deb'], ${'nlvl' . $ind}['solde_cred']);
$side_lv = ($solde_lv > 0) ? "D" : "C";
$side_lv = ($solde_lv == 0) ? "" : $side_lv;
$pdf->write_cell(25, 6, nbm(abs($solde_lv)) . " $side_lv", 0, 0, 'R');
$pdf->write_cell(25, 6, nbm(abs($solde_lv)) . " $side_lv", "TB", 0, 'R');
$pdf->line_new();
$pdf->SetFont('DejaVuCond', '', 7);
${'lvl' . $ind . '_old'} = substr($r['poste'], 0, $ind);

View file

@ -35,7 +35,7 @@ class Html_Tab
private $content ; //!< static content of the tab
private $mode ; //!< possible values are static if the content is static, ajax for calling an ajax, link for a html link, default static
private $link; //!< the javascript or an html link, depending of the $mode
private $comment; //!< comment to add when we use the row
/**
*@example html_tab.test.php
*/
@ -44,7 +44,27 @@ class Html_Tab
$this->id=$p_id;
$this->title=$p_title;
$this->mode='static';
$this->comment="";
}
/**
* @return string
*/
public function get_comment()
{
return $this->comment;
return $this;
}
/**
* @param string $comment
*/
public function set_comment($comment)
{
$this->comment = $comment;
return $this;
}
public function get_id()
{
return $this->id;

View file

@ -106,4 +106,5 @@ content[72]="<?php echo _("Pour les journaux FIN, ce sera la fiche du journal");
content[73]="<?php echo _("Mettre à oui pour un journal dédié uniquement aux notes de crédit ou de débit, il affichera un avertissement si le montant n'est pas en négatif");?>";
content[74]="<?php echo _('TVA due ou récupérable quand l\'opération est payée ou exécutée')?>";
content[75]="<?php echo _('Journaux Achat ou vente en mode simple, TVA ou détaillé')?>";
content[76]="<?php echo _('Il est conseillé d\'avoir un quickcode de moins de 9 car.')?>";
</script>

View file

@ -58,7 +58,7 @@ class Noalyss_Csv
* Correct the name of the file , remove forbidden character and
* add extension and date
*/
private function correct_name()
protected function correct_name()
{
if (trim(strlen($this->filename))==0) {
record_log('CSV->correct_name filename is empty');
@ -157,7 +157,7 @@ class Noalyss_Csv
/**
* clean the row
*/
private function clean()
protected function clean()
{
$this->element=array();
$this->size=0;
@ -166,7 +166,7 @@ class Noalyss_Csv
* format the number for the CSV export
* @param $p_number number
*/
private function nb($p_number)
protected function nb($p_number)
{
$p_number=trim($p_number);
if ($p_number=="") {return $p_number;}
@ -177,12 +177,118 @@ class Noalyss_Csv
}
return $r;
}
private function encode($str)
protected function encode($str)
{
if ($this->encoding=="utf8") return $str;
if ($this->encoding=="latin1") return utf8_decode ($str);
throw new Exception(_("Encodage invalide"));
}
/**
* @return mixed
*/
public function get_filename()
{
return $this->filename;
return $this;
}
/**
* @param mixed $filename
*/
public function set_filename($filename)
{
$this->filename = $filename;
return $this;
}
/**
* @return array
*/
public function get_element()
{
return $this->element;
return $this;
}
/**
* @param array $element
*/
public function set_element($element)
{
$this->element = $element;
return $this;
}
/**
* @return mixed
*/
public function get_sep_field()
{
return $this->sep_field;
return $this;
}
/**
* @param mixed $sep_field
*/
public function set_sep_field($sep_field)
{
$this->sep_field = $sep_field;
return $this;
}
/**
* @return mixed
*/
public function get_sep_dec()
{
return $this->sep_dec;
return $this;
}
/**
* @param mixed $sep_dec
*/
public function set_sep_dec($sep_dec)
{
$this->sep_dec = $sep_dec;
return $this;
}
/**
* @return mixed
*/
public function get_encoding()
{
return $this->encoding;
return $this;
}
/**
* @param mixed $encoding
*/
public function set_encoding($encoding)
{
$this->encoding = $encoding;
return $this;
}
/**
* @return int
*/
public function get_size()
{
return $this->size;
return $this;
}
/**
* @param int $size
*/
public function set_size($size)
{
$this->size = $size;
return $this;
}
}

View file

@ -37,24 +37,101 @@ class Output_Html_Tab
{
private $a_tabs; //!< array of html tabs
private $class_tab; //!< for normal tab
private $class_tab_selected; //!< for class_tab_selected
private $mode; //!< mode default tabs
/**
*@example html_tab.test.php
*/
function __construct()
{
$this->a_tabs=[];
$this->class_tab="tabs";
$this->class_tab_selected="tabs_selected";
}
/**
* Add Html_Tab
* get the mode , possible value are row or tabs
* @return mixed
*/
public function get_mode()
{
return $this->mode;
return $this;
}
/**
* set the mode , possible values are row or tabs
* @param mixed $mode
*/
public function set_mode($mode)
{
if ($mode != "row" && $mode != "tab") {
throw new Exception(_("OUTPUTHTML070 Mode invalide"));
}
$this->mode = $mode;
if ($mode == "row") {
$this->set_class_tab_selected("tab_row_selected");
$this->set_class_tab("tab_row");
}
if ( $mode == "tab") {
$this->set_class_tab_selected("tabs_selected");
$this->set_class_tab("tabs");
}
return $this;
}
/**
* Add Html_Tab
* @param Html_Tab $p_html_tab
*/
function add(Html_Tab $p_html_tab)
{
$this->a_tabs[]=clone $p_html_tab;
}
/**
* get the CSS class of tabs
* @return mixed
*/
public function get_class_tab()
{
return $this->class_tab;
return $this;
}
/**
* set the CSS class of tabs, default is tabs
* @param mixed $class_tab
*/
public function set_class_tab($class_tab)
{
$this->class_tab = $class_tab;
return $this;
}
/**
* get the CSS class of tabs_selected
* @return mixed
*/
public function get_class_tab_selected()
{
return $this->class_tab_selected;
return $this;
}
/**
* set the CSS class of tabs, default is tabs_selected
* @param mixed $class_tab_selected
*/
public function set_class_tab_selected($class_tab_selected)
{
$this->class_tab_selected = $class_tab_selected;
return $this;
}
/**
* Build the javascript to change the class name of the selected tab, hide other div and show the selected one
* @param string $p_not_hidden id of the showed tab
@ -66,20 +143,44 @@ class Output_Html_Tab
$nb=count($this->a_tabs);
for ($i =0 ; $i < $nb;$i++)
{
if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
$r .= sprintf("$('div%s').hide();",$this->a_tabs[$i]->get_id() );
$r .= sprintf("$('tab%s').className='tabs';",$this->a_tabs[$i]->get_id() );
} else {
$r .= sprintf("$('div%s').show();",$p_not_hidden );
$r .= sprintf("$('tab%s').className='tabs_selected';",$p_not_hidden );
if ($this->get_mode()=="tab") {
if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
$r .= sprintf("$('div%s').hide();",$this->a_tabs[$i]->get_id() );
$r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab );
} else {
$r .= sprintf("$('div%s').show();",$p_not_hidden );
$r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected);
}
} elseif ($this->get_mode()=="row") {
if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
$r .= sprintf("Effect.BlindUp('div%s',{duration : 0.7});",$this->a_tabs[$i]->get_id() );
$r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab );
} else {
$r .= sprintf("Effect.SlideDown('div%s',{duration : 0.7});",$p_not_hidden );
$r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected);
}
}
}
return $r;
}
/**
* When printing row , a comment is written if not empty
* @param $p_index
*/
protected function print_comment($p_index) {
printf ('<span class="%s"> %s </span>',
$this->get_class_tab(),
$this->a_tabs[$p_index]->get_comment()
);
}
/**
* print the html + javascript code of the tabs and the div
*
*
*/
function output()
{
@ -88,18 +189,21 @@ class Output_Html_Tab
{
return;
}
echo '<ul class="tabs">';
printf ( '<ul class="%s">',$this->class_tab);
for ($i=0; $i<$nb; $i++)
{
printf ('<li id="tab%s" class="tabs">',
$this->a_tabs[$i]->get_id());
printf ('<li id="tab%s" class="%s">',
$this->a_tabs[$i]->get_id(),$this->class_tab);
switch ($this->a_tabs[$i]->get_mode())
{
case 'link':
printf ('<a id="%s" href="%s">',
$this->a_tabs[$i]->get_id(),
$this->a_tabs[$i]->get_link());
echo $this->a_tabs[$i]->get_title();
printf ('<span class="title_%s"> %s </span>',
$this->get_class_tab(),
$this->a_tabs[$i]->get_title()
);
echo '</a>';
break;
@ -107,6 +211,11 @@ class Output_Html_Tab
printf('<a id="%s" onclick="%s">',
$this->a_tabs[$i]->get_id(),
$this->a_tabs[$i]->get_link());
printf ('<span class="title_%s"> %s </span>',
$this->get_class_tab(),
$this->a_tabs[$i]->get_title()
);
echo $this->a_tabs[$i]->get_title();
echo '</a>';
break;
@ -114,22 +223,39 @@ class Output_Html_Tab
// show one , hide other
$script=$this->build_js($this->a_tabs[$i]->get_id());
printf('<a onclick="%s">', $script);
echo $this->a_tabs[$i]->get_title();
printf ('<span class="title_%s"> %s </span>',
$this->get_class_tab(),
$this->a_tabs[$i]->get_title()
);
echo '</a>';
break;
default:
break;
}
if ( $this->get_mode()=="row") {
$this->print_comment($i);
}
echo '</li>';
if ( $this->get_mode()=="row") {
$this->print_div($i);
}
}
echo '</ul>';
for ($i=0;$i<$nb;$i++)
{
printf('<div id="div%s" style="display:none;clear:both">',$this->a_tabs[$i]->get_id());
echo $this->a_tabs[$i]->get_content();
echo '</div>';
if ( $this->get_mode()=="tab" ) {
for ($i=0;$i<$nb;$i++)
{
$this->print_div($i);
}
}
}
private function print_div($p_index)
{
printf('<div id="div%s" style="display:none;clear:both" class="tab_row">',$this->a_tabs[$p_index]->get_id());
echo $this->a_tabs[$p_index]->get_content();
echo '</div>';
}
}

View file

@ -108,7 +108,7 @@ $iconcerned->amount_id="totalDeb";
printf (_("Opération rapprochée : %s"),$iconcerned->input());
echo '<p>';
echo HtmlInput::button('add', _('Ajout d\'une ligne'), 'onClick="quick_writing_add_row()"');
echo Html_Input_Noalyss::ledger_add_item("M");
echo HtmlInput::submit('summary', _('Sauvez'));
echo '</p>';

View file

@ -36,7 +36,7 @@ echo '<tr>';
echo $item['quick_code'];
echo '<td>'.$item['bt'].'</td>';
?>
<td style="border-bottom: 1px dotted grey; width: 75%;"><?php echo $item['denom'] ?></td>
<td style="border-bottom: 1px dotted grey;"><?php echo $item['denom'] ?></td>
<?php
echo td($item['pu']);
echo td($item['quantity' ]);