Code #0001905: Champ pour Registre des Personnes Morales (RPM)

Réécriture complete de COMPANY , ajout libres de paramètres
This commit is contained in:
sparkyx 2021-03-29 15:26:42 +02:00
parent e730ac251d
commit edbb7bcc46
10 changed files with 600 additions and 150 deletions

View file

@ -289,7 +289,9 @@ $path = array(
// add or update forecast_category
"forecast_category"=>"ajax_forecast_category",
// manage forecast
"forecast"=>"ajax_forecast"
"forecast"=>"ajax_forecast",
// manage company
"company"=>"ajax_company"
) ;
if (array_key_exists($op, $path)) {

View file

@ -202,7 +202,7 @@ div.recherche_form{
div.content{
padding-top:0.0030%;
margin-top:0.0030%;
width:100%;
width:98%;
font-family: Arial, Helvetica, "Liberation Sans", FreeSans, sans-serif;
font-family: 'OpenSansRegular';
font-size:12px;
@ -2809,4 +2809,39 @@ span.tagcell {
/**========*/
#sold_item {
width: 100%;
}
}
/***
* w-20 width is 20 rem
**** **/
.w-20 {
/* width: 20rem !important;*/
width: 100% !important;
}
/* SM */
@media (min-width: 576px) {
.w-20 {
/* width: 20rem !important;*/
width: 100% !important;
}
}
/* MD */
@media (min-width: 768px) {
.w-20 {
/* width: 20rem !important;*/
width: 100% !important;
}
}
/* LG */
@media (min-width: 992px) {
.w-20 {
/* width: 20rem !important;*/
width: 40% !important;
}
}
/* XL */
@media (min-width: 1200px) {
}
/**========*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

View file

@ -0,0 +1,61 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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.
*
* PhpCompta 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 PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief called from company.inc.php , add or modify extra parameter
*/
global $g_user;
if ($g_user->check_module("COMPANY")==0) die();
require_once NOALYSS_INCLUDE.'/class/parameter_extra_mtable.class.php';
$http=new HttpInput();
try {
$table=$http->request('table');
$action=$http->request('action');
$p_id=$http->request('p_id', "number");
$ctl_id=$http->request('ctl');
} catch(Exception $e) {
echo $e->getMessage();
return;
}
$parameter_extra =Parameter_Extra_MTable::build($p_id);
$parameter_extra->set_object_name($ctl_id);
if ($action=="input")
{
$parameter_extra->send_header();
echo $parameter_extra->ajax_input()->saveXML();
return;
}elseif ($action == "save") {
$parameter_extra->send_header();
echo $parameter_extra->ajax_save()->saveXML();
return;
} elseif ($action == "delete") {
$parameter_extra->send_header();
echo $parameter_extra->ajax_delete()->saveXML();
return;
}

View file

@ -698,6 +698,7 @@ class Document
static $aTag=NULL;
static $counter_tag=0; /* <! counter for the tags */
static $aParameterExtra=NULL; // Extra parameter for the company
switch ($p_tag)
{
case 'DATE':
@ -749,6 +750,8 @@ class Document
case 'MY_PAYS':
$r=$g_parameter->MY_PAYS;
break;
// customer
/* \note The CUST_* are retrieved thx the $p_array['tiers']
@ -1634,6 +1637,7 @@ class Document
where ag_id=$1", array($p_array["ag_id"]));
}
return $ret;
} // end switch
/*
* retrieve the value of ATTR for e_march
@ -1646,6 +1650,7 @@ class Document
{
$id=$p_array['e_march'.$this->counter];
$r=$this->replace_special_tag($id, $p_tag);
return $r;
}
}
/*
@ -1657,6 +1662,7 @@ class Document
$qcode=isset($p_array['qcode_benef'])?$p_array['qcode_benef']:'';
// Retrieve f_id
$r=$this->replace_special_tag($qcode, $p_tag);
return $r;
}
if (preg_match('/^CUSTATTR/', $p_tag)==1)
{
@ -1666,7 +1672,13 @@ class Document
$qcode=(isset($p_array['qcode_dest']))?$p_array['qcode_dest']:$p_array['e_client'];
$r=$this->replace_special_tag($qcode, $p_tag);
}
return $r;
}
// check also if the tag does exist in parameter_extra table
$pe_value=$this->db->get_value("select pe_value from parameter_extra where pe_code=$1",[$p_tag]);
if ( $this->db->count() > 0 ) { return $pe_value;}
return $r;
}

View file

@ -0,0 +1,87 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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.
*
* PhpCompta 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 PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief
*/
require_once NOALYSS_INCLUDE."/database/parameter_extra_sql.class.php";
require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
class Parameter_Extra_MTable extends Manage_Table_SQL
{
function __construct(\Data_SQL $p_table)
{
parent::__construct($p_table);
}
static function build ($p_id=-1)
{
$cn=Dossier::connect();
$object_sql=new Parameter_Extra_SQL($cn,$p_id);
$object=new Parameter_Extra_MTable($object_sql);
$object->set_button_add_top(false);
$object->set_col_label("pe_code", _("Code"));
$object->set_col_label("pe_label", _("Intitulé"));
$object->set_col_label("pe_value", _("Valeur"));
$object->set_order(['pe_code','pe_label','pe_value']);
$object->set_search_table(false);
$object->set_callback("ajax_misc.php");
$object->add_json_param("op", "company");
$object->setCssClass("inner_box w-20");
return $object;
}
/**
* Check before insert or update
*/
function check() {
$object=$this->get_table();
$cn=$object->cn;
$error=0;
// duplicate
$code=$cn->get_value("select comptaproc.transform_to_code($1)",[ $object->getp("pe_code")]);
if ( $cn->get_value("select count(*) from parameter_extra where pe_code =$1 and id != $2",
[$code,$object->getp("id")]) > 0 ) {
$this->set_error("pe_code", _("Code déjà utilisé"));
$error++;
}
// pe_code cannot be empyt
if ( $code == "") {
$this->set_error("pe_code", _("ne peut être vide"));
$error++;
}
// pe_code cannot be empyt
if ( preg_match('/^ATTR/', $code) == 1 ||
preg_match('/^CUSTATTR/', $code) == 1 ||
preg_match('/^BENEFATTR/', $code) == 1 )
{
$this->set_error("pe_code", _("ne peut être pas commencer par ATTR , BENEFATTR ou CUSTATTR"));
$error++;
}
if ($error > 0) { return false;}
return true;
}
}

View file

@ -17,185 +17,300 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!
/* !
* \file
*\brief Manage the company setting : address, vat number, Check period, VAT,
* \brief Manage the company setting : address, vat number, Check period, VAT,
* CA ....
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
require_once NOALYSS_INCLUDE.'/class/parameter_extra_mtable.class.php';
global $g_user;
$http=new HttpInput();
echo '<div class="content">';
if (isset($_POST['record_company']))
{
$m = new Noalyss_Parameter_Folder($cn);
$m->MY_NAME = $http->post("p_name");
$m->MY_TVA = $http->post("p_tva");
$m->MY_STREET = $http->post("p_street");
$m->MY_NUMBER = $http->post("p_no");
$m->MY_CP = $http->post("p_cp");
$m->MY_COMMUNE = $http->post("p_Commune");
$m->MY_TEL = $http->post("p_tel");
$m->MY_FAX = $http->post("p_fax");
$m->MY_PAYS = $http->post("p_pays");
$m->MY_CHECK_PERIODE =$http->post("p_check_periode");
$m->MY_DATE_SUGGEST = $http->post("p_date_suggest");
$m->MY_ANALYTIC =$http->post("p_compta");
$m->MY_STRICT = $http->post("p_strict");
$m->MY_TVA_USE = $http->post("p_tva_use");
$m->MY_PJ_SUGGEST = $http->post("p_pj");
$m->MY_ALPHANUM = $http->post("p_alphanum");
$m->MY_UPDLAB = $http->post("p_updlab");
$m->MY_STOCK =$http->post("p_stock");
$m->MY_CURRENCY =$http->post("p_currency");
$m->MY_DEFAULT_ROUND_ERROR_DEB=$http->post("p_round_error_deb");
$m->MY_DEFAULT_ROUND_ERROR_CRED=$http->post("p_round_error_cred");
$m->MY_ANC_FILTER=$http->post("p_anc_filter");
try{
$m->update();
} catch (Exception $e) {
alert($e->getMessage());
}
$m=new Noalyss_Parameter_Folder($cn);
$m->MY_NAME=$http->post("p_name");
$m->MY_TVA=$http->post("p_tva");
$m->MY_STREET=$http->post("p_street");
$m->MY_NUMBER=$http->post("p_no");
$m->MY_CP=$http->post("p_cp");
$m->MY_COMMUNE=$http->post("p_Commune");
$m->MY_TEL=$http->post("p_tel");
$m->MY_FAX=$http->post("p_fax");
$m->MY_PAYS=$http->post("p_pays");
$m->MY_CHECK_PERIODE=$http->post("p_check_periode");
$m->MY_DATE_SUGGEST=$http->post("p_date_suggest");
$m->MY_ANALYTIC=$http->post("p_compta");
$m->MY_STRICT=$http->post("p_strict");
$m->MY_TVA_USE=$http->post("p_tva_use");
$m->MY_PJ_SUGGEST=$http->post("p_pj");
$m->MY_ALPHANUM=$http->post("p_alphanum");
$m->MY_UPDLAB=$http->post("p_updlab");
$m->MY_STOCK=$http->post("p_stock");
$m->MY_CURRENCY=$http->post("p_currency");
$m->MY_DEFAULT_ROUND_ERROR_DEB=$http->post("p_round_error_deb");
$m->MY_DEFAULT_ROUND_ERROR_CRED=$http->post("p_round_error_cred");
$m->MY_ANC_FILTER=$http->post("p_anc_filter");
try
{
$m->update();
}
catch (Exception $e)
{
alert($e->getMessage());
}
}
$my = new Noalyss_Parameter_Folder($cn);
$my=new Noalyss_Parameter_Folder($cn);
///// Compta analytic
$array = array(
array("value" => "ob", 'label' => _("obligatoire")),
array("value" => "op", 'label' => _("optionnel")),
array("value" => "nu", 'label' => _("non utilisé"))
$array=array(
array("value"=>"ob", 'label'=>_("obligatoire")),
array("value"=>"op", 'label'=>_("optionnel")),
array("value"=>"nu", 'label'=>_("non utilisé"))
);
$strict_array = array(
array('value' => 'N', 'label' => _('Non')),
array('value' => 'Y', 'label' => _('Oui'))
$strict_array=array(
array('value'=>'N', 'label'=>_('Non')),
array('value'=>'Y', 'label'=>_('Oui'))
);
$alpha_num_array[0] = array('value' => 'N', 'label' => _('Non'));
$alpha_num_array[1] = array('value' => 'Y', 'label' => _('Oui'));
$alpha_num_array[0]=array('value'=>'N', 'label'=>_('Non'));
$alpha_num_array[1]=array('value'=>'Y', 'label'=>_('Oui'));
$updlab_array[0] = array('value' => 'N', 'label' => _('Non'));
$updlab_array[1] = array('value' => 'Y', 'label' => _('Oui'));
$updlab_array[0]=array('value'=>'N', 'label'=>_('Non'));
$updlab_array[1]=array('value'=>'Y', 'label'=>_('Oui'));
$compta = new ISelect();
$compta->table = 1;
$compta->selected = $my->MY_ANALYTIC;
$compta=new ISelect();
$compta->selected=$my->MY_ANALYTIC;
$strict = new ISelect();
$strict->table = 1;
$strict->selected = $my->MY_STRICT;
$strict=new ISelect();
$strict->selected=$my->MY_STRICT;
$tva_use = new ISelect();
$tva_use->table = 1;
$tva_use->selected = $my->MY_TVA_USE;
$tva_use=new ISelect();
$tva_use->selected=$my->MY_TVA_USE;
$pj_suggest = new ISelect();
$pj_suggest->table = 1;
$pj_suggest->selected = $my->MY_PJ_SUGGEST;
$pj_suggest=new ISelect();
$pj_suggest->selected=$my->MY_PJ_SUGGEST;
$date_suggest = new ISelect();
$date_suggest->table = 1;
$date_suggest->selected = $my->MY_DATE_SUGGEST;
$date_suggest=new ISelect();
$date_suggest->selected=$my->MY_DATE_SUGGEST;
$check_periode = new ISelect();
$check_periode->table = 1;
$check_periode->selected = $my->MY_CHECK_PERIODE;
$alpha_num = new ISelect();
$alpha_num->table = 1;
$alpha_num->value = $alpha_num_array;
$alpha_num->selected = $my->MY_ALPHANUM;
$check_periode=new ISelect();
$check_periode->selected=$my->MY_CHECK_PERIODE;
$alpha_num=new ISelect();
$alpha_num->value=$alpha_num_array;
$alpha_num->selected=$my->MY_ALPHANUM;
$updlab = new ISelect();
$updlab->table = 1;
$updlab->value = $updlab_array;
$updlab->selected = $my->MY_UPDLAB;
$updlab=new ISelect();
$updlab->value=$updlab_array;
$updlab->selected=$my->MY_UPDLAB;
$stock = new ISelect('p_stock');
$stock->value = array(
array('value' => 'N', 'label' => _('Non')),
array('value' => 'Y', 'label' => _('Oui'))
$stock=new ISelect('p_stock');
$stock->value=array(
array('value'=>'N', 'label'=>_('Non')),
array('value'=>'Y', 'label'=>_('Oui'))
);
$stock->selected = $my->MY_STOCK;
$stock->table = 1;
$stock->selected=$my->MY_STOCK;
$anc_filter=new IText("p_anc_filter", $my->MY_ANC_FILTER);
$anc_filter->placeholder='6,7';
$anc_filter->title=_("Uniquement des chiffres séparés par des virgules");
$use_currency= new ISelect();
$use_currency->table = 1;
$use_currency->value = $updlab_array;
$use_currency->selected = $my->MY_CURRENCY;
$use_currency=new ISelect();
$use_currency->value=$updlab_array;
$use_currency->selected=$my->MY_CURRENCY;
$default_error_deb=new IPoste("p_round_error_deb",$my->MY_DEFAULT_ROUND_ERROR_DEB);
$default_error_deb->name = 'p_round_error_deb';
$default_error_deb->set_attribute('gDossier',Dossier::id());
$default_error_deb->set_attribute('jrn',0);
$default_error_deb->set_attribute('account','p_round_error_deb');
$default_error_deb=new IPoste("p_round_error_deb", $my->MY_DEFAULT_ROUND_ERROR_DEB);
$default_error_deb->name='p_round_error_deb';
$default_error_deb->set_attribute('gDossier', Dossier::id());
$default_error_deb->set_attribute('jrn', 0);
$default_error_deb->set_attribute('account', 'p_round_error_deb');
$default_error_cred=new IPoste("p_round_error_deb",$my->MY_DEFAULT_ROUND_ERROR_CRED);
$default_error_cred->name = 'p_round_error_cred';
$default_error_cred->set_attribute('gDossier',Dossier::id());
$default_error_cred->set_attribute('jrn',0);
$default_error_cred->set_attribute('account','p_round_error_cred');
$default_error_cred=new IPoste("p_round_error_cred", $my->MY_DEFAULT_ROUND_ERROR_CRED);
$default_error_cred->name='p_round_error_cred';
$default_error_cred->set_attribute('gDossier', Dossier::id());
$default_error_cred->set_attribute('jrn', 0);
$default_error_cred->set_attribute('account', 'p_round_error_cred');
// other parameters
$all = new IText();
$all->table = 1;
echo '<form method="post" >';
echo dossier::hidden();
echo "<table class=\"result\" style=\"width:auto\">";
echo "<tr>" . td(_('Nom société'), 'style="text-align:right"') . $all->input("p_name", $my->MY_NAME) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Téléphone"), 'style="text-align:right"') . $all->input("p_tel", $my->MY_TEL) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Fax"), 'style="text-align:right"') . $all->input("p_fax", $my->MY_FAX) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Rue "), 'style="text-align:right"') . $all->input("p_street", $my->MY_STREET) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Numéro"), 'style="text-align:right"') . $all->input("p_no", $my->MY_NUMBER) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Code Postal"), 'style="text-align:right"') . $all->input("p_cp", $my->MY_CP) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Commune"), 'style="text-align:right"') . $all->input("p_Commune", $my->MY_COMMUNE) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Pays"), 'style="text-align:right"') . $all->input("p_pays", $my->MY_PAYS) . "</tr>";
$all->value = '';
echo "<tr>" . td(_("Numéro de Tva"), 'style="text-align:right"') . $all->input("p_tva", $my->MY_TVA) . "</tr>";
echo "<tr>" . td(_("Utilisation de la compta. analytique"), 'style="text-align:right"') .
$compta->input("p_compta", $array) . "</tr>";
echo '<tr>'. td(_("Opération analytique uniquement pour les postes comptables commençant par")).
'<td>'.
$anc_filter->input().
Icon_Action::tips($anc_filter->title);
'</td>'.
'</tr>';
echo "<tr>" . td(_("Utilisation des stocks"), 'style="text-align:right"') . $stock->input() . "</tr>";
echo "<tr>" . td(_("Utilisation de devises étrangères"), 'style="text-align:right"') . $use_currency->input("p_currency", $strict_array) . "</tr>";
echo "<tr>" . td(_("Utilisation du mode strict "), 'style="text-align:right"') . $strict->input("p_strict", $strict_array) . "</tr>";
echo "<tr>" . td(_("Assujetti à la tva"), 'style="text-align:right"') . $tva_use->input("p_tva_use", $strict_array) . "</tr>";
echo "<tr>" . td(_("Suggérer le numéro de pièce justificative"), 'style="text-align:right"') . $pj_suggest->input("p_pj", $strict_array) . "</tr>";
echo "<tr>" . td(_("Suggérer la date"), 'style="text-align:right"') . $date_suggest->input("p_date_suggest", $strict_array) . "</tr>";
echo '<tr>' . td(_('Afficher la période comptable pour éviter les erreurs de date'), 'style="text-align:right"') . $check_periode->input('p_check_periode', $strict_array) . '</tr>';
echo '<tr>' . td(_('Utilisez des postes comptables alphanumérique'), 'style="text-align:right"') . $alpha_num->input('p_alphanum') . '</tr>';
echo '<tr>' . td(_('Changer le libellé des détails'), 'style="text-align:right"') . $updlab->input('p_updlab') . '</tr>';
echo '<tr>' .
td(_("Poste comptable de CHARGE (D) pour les différences d'arrondi pour les opérations en devise")).
'<td>'.$default_error_deb->input().
'</td>'.
'</tr>';
echo '<tr>' .
td(_("Poste comptable en PRODUIT (C) pour les différences d'arrondi pour les opérations en devise")).
'<td>'.$default_error_cred->input().
'</td>'.
'</tr>';
echo "</table>";
echo HtmlInput::submit("record_company", _("Sauve"));
echo "</form>";
echo '</div>';
return;
$all=new IText();
$all->table=1;
$all->style=' class="input_text"';
?>
<form method="post" >
<?= dossier::hidden(); ?>
<div class="row">
<div class="col">
<h2>Société</h2>
<div class="form-group">
<label class="w-20" for="p_name"><?= _("Nom Société") ?></label>
<?= $all->input("p_name", $my->MY_NAME) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_tel"><?= _("Téléphone") ?></label>
<?= $all->input("p_name", $my->MY_TEL) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_fax"><?= _("Fax") ?></label>
<?= $all->input("p_name", $my->MY_FAX) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_street"><?= _("Rue") ?></label>
<?= $all->input("p_name", $my->MY_STREET) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_no"><?= _("Numéro") ?></label>
<?= $all->input("p_name", $my->MY_NUMBER) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_cp"><?= _("Code Postal") ?></label>
<?= $all->input("p_name", $my->MY_CP) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_commune"><?= _("Nom Société") ?></label>
<?= $all->input("p_name", $my->MY_COMMUNE) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_tva"><?= _("Pays") ?></label>
<?= $all->input("p_name", $my->MY_PAYS) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_name"><?= _("Numéro de Tva") ?></label>
<?= $all->input("p_name", $my->MY_TVA) ?>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-4">
<?php
echo HtmlInput::submit("record_company", _("Sauve"), "", "button");
?>
</div>
<div class="col-4"></div>
</div>
<div class="row">
<div class="col">
<h2>Paramètre supplémentaire</h2>
<?php
$object=Parameter_Extra_MTable::build();
$object->create_js_script();
$object->display_table();
?>
</div>
</div>
</div>
<div class="col">
<h2>Fonctionnement</h2>
<div class="form-group">
<label class="w-20" for="p_compta">
<?= _("Utilisation de la compta. analytique") ?></label>
<?= $compta->input("p_compta", $array) ?>
</div>
<div class="form-group">
<label class="" for="p_anc_filter">
<?= _("Opération analytique uniquement pour les postes comptables commençant par") ?>
</label>
<?php
echo $anc_filter->input();
echo Icon_Action::tips($anc_filter->title);
?>
</div>
<div class="form-group">
<label class="w-20" for="p_stock"><?= _("Utilisation des stocks") ?></label>
<?= $stock->input() ?>
</div>
<div class="form-group">
<label class="w-20" for="p_strict"><?= _("Utilisation du mode strict ") ?></label>
<?= $strict->input("p_strict", $strict_array) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_tva_use"><?= _("Assujetti à la tva") ?></label>
<?= $tva_use->input("p_tva_use", $strict_array) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_pj"><?= _("Suggérer le numéro de pièce justificative") ?>
</label>
<?= $pj_suggest->input("p_pj", $strict_array) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_date_suggest"><?= _("Suggérer la date") ?></label>
<?= $date_suggest->input("p_date_suggest", $strict_array) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_check_periode"><?= _('Afficher la période comptable pour éviter les erreurs de date') ?>
</label>
<?= $check_periode->input('p_check_periode', $strict_array) ?>
</div>
<div class="form-group">
<label class="w-20" for="p_alphanum">
<?= _('Utilisez des postes comptables alphanumérique') ?>
</label>
<?= $alpha_num->input('p_alphanum') ?>
</div>
<div class="form-group">
<label class="w-20" for="p_updlab">
<?= _('Changer le libellé des détails') ?>
</label>
<?= $updlab->input('p_updlab') ?>
</div>
<div class="form-group">
<label class="" for="p_round_error_deb">
<?= _("Poste comptable de CHARGE (D) pour les différences d'arrondi pour les opérations en devise") ?>
</label>
<?= $default_error_deb->input() ?>
</div>
<div class="form-group">
<label class="" for="p_round_error_cred">
<?= _("Poste comptable en PRODUIT (C) pour les différences d'arrondi pour les opérations en devise") ?>
</label>
<?= $default_error_cred->input() ?>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-4">
<?php
echo HtmlInput::submit("record_company", _("Sauve"), "", "button");
?>
</div>
<div class="col-4"></div>
</div>
</div>
</div>
</form>

View file

@ -110,7 +110,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
define ("DBVERSION",154);
define ("DBVERSION",155);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",19);
define ('NOTFOUND','--not found--');

View file

@ -0,0 +1,66 @@
<?php
/**
* Autogenerated file
* 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
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
* class_parameter_extra_sql.php
*
*@file
*@brief abstract of the table public.parameter_extra */
class Parameter_Extra_SQL extends Noalyss_SQL
{
function __construct(DatabaseCore $p_cn,$p_id=-1)
{
$this->table = "public.parameter_extra";
$this->primary_key = "id";
/*
* List of columns
*/
$this->name=array(
"id"=>"id"
,"pe_code"=>"pe_code"
,"pe_label"=>"pe_label"
,"pe_value"=>"pe_value"
);
/*
* Type of columns
*/
$this->type = array(
"id"=>"numeric"
,"pe_code"=>"text"
,"pe_label"=>"text"
,"pe_value"=>"text"
);
$this->default = array(
"id" => "auto"
);
$this->date_format = "DD.MM.YYYY";
parent::__construct($p_cn,$p_id);
}
}

View file

@ -0,0 +1,72 @@
begin;
create table parameter_extra (id serial primary key , pe_code text,pe_label text ,pe_value text);
alter table parameter_extra add constraint pe_code_ux unique (pe_code);
comment on table parameter_extra is 'Extra parameter for the folder';
comment on column parameter_extra.pe_code is 'Code used in the Document:generate';
comment on column parameter_extra.pe_label is 'Label description';
comment on column parameter_extra.pe_value is 'Value which will replace the tag in Document:generate';
CREATE OR REPLACE FUNCTION comptaproc.transform_to_code(p_account text)
RETURNS text
AS $function$
declare
sResult text;
begin
sResult := lower(p_account);
sResult := translate(sResult,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
sResult := translate(sResult,E' $€µ£%.+-/\\!(){}(),;&|"#''^<>*','');
return upper(sResult);
end;
$function$
LANGUAGE plpgsql;
create or replace function comptaproc.t_parameter_extra_code () returns trigger
as $fct$
begin
new.pe_code := comptaproc.transform_to_code (new.pe_code);
return new;
end;
$fct$
language plpgsql;
create trigger trigger_parameter_extra_format_code_biu
before insert or update on parameter_extra for each row execute procedure comptaproc.t_parameter_extra_code();
create or replace function tmp_1 () returns void
as
$fct$
declare
sCountry text;
begin
select pr_value into sCountry from parameter where pr_id='MY_COUNTRY';
if sCountry = 'BE' then
insert into parameter_extra(pe_code,pe_label) values ('RPM','RPM'), ('ONSS','Numéro ONSS');
end if;
if sCountry = 'FR' then
insert into parameter_extra(pe_code,pe_label) values ('SIRET','SIRET'), ('SIREN','SIREN');
end if;
insert into parameter_extra (pe_code,pe_label) values ('email_company','Email Société'),('web_company','Site Web');
end;
$fct$
language plpgsql;
select tmp_1();
drop function tmp_1;
insert into version (val,v_description) values (155,'Rewriting of COMPANY add extra parameter');
commit;