Code improve

Todo List to finish , allow a empty date
This commit is contained in:
sparkyx 2024-12-14 17:45:38 +01:00
parent 3d89ad3f19
commit b282f2846b
14 changed files with 123 additions and 70 deletions

View file

@ -1210,13 +1210,13 @@ function success_dsp_letter(req) {
try {
code_html.evalScripts();
} catch (e) {
alert_box("DSPLETTER:" + content[48] + e.message);
alert_box("DSPLETTER1:" + content[48] + e.message);
}
}
function error_dsp_letter(req) {
alert_box("DSPLETTER:" + content[48]);
alert_box("DSPLETTER2:" + content[48]);
}
function search_letter(obj) {

View file

@ -3555,7 +3555,7 @@ var Periode = function (p_ledger) {
}
}
if (count == 0) {
smoke.signal("Sélectionner au moins une période", function () {
smoke.signal("Sélectionner au moins une période", function () {
}, {duration: 1500});
return;
}

View file

@ -67,8 +67,8 @@ define('ALLOWED', 1);
load_all_script();
// To enable assert , set "zend.assertions" in the php.ini file
ini_set("assert.active",1);
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
// assert_options(ASSERT_ACTIVE, 1);
//assert_options(ASSERT_WARNING, 1);
//removed in PHP8 assert_options(ASSERT_QUIET_EVAL, 1);
function my_assert_handler($file, $line, $code)
{
@ -77,7 +77,7 @@ function my_assert_handler($file, $line, $code)
Line '$line'<br />
Code '$code'<br /><hr />";
}
assert_options(ASSERT_CALLBACK, 'my_assert_handler');
//assert_options(ASSERT_CALLBACK, 'my_assert_handler');
/******************************************************************************************************************/
/* Utilities
/******************************************************************************************************************/

View file

@ -47,9 +47,9 @@ class Acc_Ledger_Search
* - 1 means all the ledger of this type
* - 0 No have the "Tous les journaux" availables
* @param $div is the div (for reconciliation)
* @param type $p_type
* @param type $p_all
* @param type $p_div
* @param string $p_type ACH, VEN , ODS or FIN
* @param int $p_all 1 means all the ledger
* @param string $p_div prefix of the DOM ID
*
* @todo the parameter $all_type_ledger is useless : ALL means all the ledgers, VEN all the ledger of sales...
*/

View file

@ -32,7 +32,13 @@
* - "start"=>"start", => date of the first day
* - "end"=>"end", => date of the last day
* - "sql_ledger"=>"sql_ledger" => the sql clause to filter on the available ledgers
*
* @see unit-test/include/class/acc_letterTest.php
*/
class Lettering
{
@ -50,6 +56,7 @@ class Lettering
var $sql_ledger;
var $object_type;
var $content;
/**
* constructor
* @param $p_init resource to database
@ -479,8 +486,12 @@ class Lettering
}
/**
* only for operation retrieved thanks a account (jrnx.j_poste)
*@class
* @brief only for operation retrieved thanks a account (jrnx.j_poste)
* manage the accounting entries for a given account
*
* @see unit-test/include/class/acc_letterTest.php
*
*/
class Lettering_Account extends Lettering
{

View file

@ -79,7 +79,8 @@ class Todo_List
}
if ( strcmp ($p_idx, 'tl_date') == 0 )
{
if ( noalyss_strlentrim($p_value) ==0 ||strlen($p_value) > 12 || isDate ($p_value) == false) return false;
if ( noalyss_strlentrim($p_value) ==0 ||strlen($p_value) > 12 || isDate ($p_value) == false)
{ $p_value = null;return true;}
}
if ( strcmp ($p_idx, 'tl_title') == 0 )
{
@ -113,7 +114,7 @@ class Todo_List
{
if ( isDate($this->tl_date) == false )
{
$this->tl_date=date('d.m.Y');
$this->tl_date=null;
}
return 0;
}
@ -129,7 +130,7 @@ class Todo_List
{
if ( $this->verify() != 0 ) return;
if (trim($this->tl_title)=='')
$this->tl_title=mb_substr(trim($this->tl_desc),0,30);
$this->tl_title=mb_substr(trim($this->tl_desc??""),0,30);
if (trim($this->tl_title)=='')
{
@ -142,6 +143,12 @@ class Todo_List
$sql="insert into todo_list (tl_date,tl_title,tl_desc,use_login,is_public) ".
" values (to_date($1,'DD.MM.YYYY'),$2,$3,$4,$5) returning tl_id";
if ($this->tl_date == null) {
$sql="insert into todo_list (tl_date,tl_title,tl_desc,use_login,is_public) ".
" values ($1,$2,$3,$4,$5) returning tl_id";
}
$res=$this->cn->exec_sql(
$sql,
array($this->tl_date,
@ -172,6 +179,11 @@ class Todo_List
$sql="update todo_list set tl_title=$1,tl_date=to_date($2,'DD.MM.YYYY'),tl_desc=$3,is_public=$5 ".
" where tl_id = $4";
if ($this->tl_date == null) {
$sql="update todo_list set tl_title=$1,tl_date=$2,tl_desc=$3,is_public=$5 ".
" where tl_id = $4";
}
$res=$this->cn->exec_sql(
$sql,
array($this->tl_title,
@ -296,7 +308,7 @@ class Todo_List
}
/**
* Display the note
* @brief Display the note
* @return html string
*/
function display()

View file

@ -1,7 +1,29 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
/*
* 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(2004) Dany De Bontridder danydb@aevalys.eu
/*!
* \file
* \brief lettering : included from include/category_card.inc.php, which is part of manager.inc.php, customer.inc.php,...
*
* some variable are already defined ($cn, $g_user ...)
*/
Noalyss\Dbg::echo_file(__FILE__);
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $g_user;
echo '<div class="content">';
@ -22,13 +44,13 @@ $periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);
$start=new IDate('start');
$start->value=(isset($_GET['start']))?$http->get('start'):$first_per->first_day();
$start->value=(isset($_GET['start']))?$http->get('start','date'):$first_per->first_day();
$r=td(_('Date début'));
$r.=td($start->input());
echo tr($r);
$end=new IDate('end');
$end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
$end->value=(isset($_GET['end']))?$http->get('end','date'):$last_per->last_day();
$r=td(_('Date fin'));
$r.=td($end->input());
echo tr($r);
@ -52,7 +74,7 @@ echo '<br>';
echo HtmlInput::submit("seek",_('Recherche'));
echo '</FORM>';
echo '</div>';
//if (! isset($_REQUEST['seek'])) exit;
echo '<hr>';
//--------------------------------------------------------------------------------
// record the data
@ -74,7 +96,7 @@ if ( isset($_GET['start']) && isset($_GET['end']))
}
}
echo '<div id="list">';
$fiche=new Fiche($cn,$_REQUEST['f_id']);
$fiche=new Fiche($cn, $http->request('f_id',"number"));
$quick_code=$fiche->get_quick_code();
$letter=new Lettering_Card($cn);
$letter->set_parameter('quick_code',$quick_code);

View file

@ -4,6 +4,7 @@ set search_path = public,comptaproc,pg_catalog ;
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
@ -14,36 +15,17 @@ SET row_security = off;
SELECT pg_catalog.lo_create('2346174');
SELECT pg_catalog.lo_create('2346176');
SELECT pg_catalog.lo_create('2346177');
SELECT pg_catalog.lo_create('2346178');
SELECT pg_catalog.lo_create('2346179');
SELECT pg_catalog.lo_create('2346181');
SELECT pg_catalog.lo_create('2346476');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (800, 'Ajout de fiche', 'fiche', 'FICADD');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (805, 'Création, modification et effacement de fiche', 'fiche', 'FIC');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (910, 'création, modification et effacement de catégorie de fiche', 'fiche', 'FICCAT');

View file

@ -9,7 +9,7 @@ export TEMPLATE=${DOMAIN}mod1
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
pg_dump -Ox -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql

View file

@ -3,6 +3,7 @@
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
@ -16,6 +17,9 @@ CREATE SCHEMA comptaproc;
CREATE SCHEMA tva_belge;
@ -6516,8 +6520,8 @@ CREATE VIEW public.v_contact AS
JOIN public.fiche_def fd ON ((f.fd_id = fd.fd_id)))
WHERE (fd.frd_id = 16)
)
SELECT cd.f_id,
cd.f_enable,
SELECT f_id,
f_enable,
( SELECT fiche_detail.ad_value
FROM public.fiche_detail
WHERE ((fiche_detail.ad_id = 32) AND (fiche_detail.f_id = cd.f_id))) AS contact_fname,
@ -6542,7 +6546,7 @@ CREATE VIEW public.v_contact AS
( SELECT fiche_detail.ad_value
FROM public.fiche_detail
WHERE ((fiche_detail.ad_id = 26) AND (fiche_detail.f_id = cd.f_id))) AS contact_fax,
cd.fd_id AS card_category
fd_id AS card_category
FROM contact_data cd;
@ -6642,10 +6646,10 @@ COMMENT ON VIEW public.vw_fiche_attr IS 'Some attribute for all cards';
CREATE VIEW public.vw_fiche_name AS
SELECT fiche_detail.f_id,
fiche_detail.ad_value AS name
SELECT f_id,
ad_value AS name
FROM public.fiche_detail
WHERE (fiche_detail.ad_id = 1);
WHERE (ad_id = 1);
@ -7036,16 +7040,16 @@ CREATE VIEW public.v_quant_detail AS
CREATE VIEW public.v_tva_rate AS
SELECT tva_rate.tva_id,
tva_rate.tva_rate,
tva_rate.tva_code,
tva_rate.tva_label,
tva_rate.tva_comment,
split_part(tva_rate.tva_poste, ','::text, 1) AS tva_purchase,
split_part(tva_rate.tva_poste, ','::text, 2) AS tva_sale,
tva_rate.tva_both_side,
tva_rate.tva_payment_purchase,
tva_rate.tva_payment_sale
SELECT tva_id,
tva_rate,
tva_code,
tva_label,
tva_comment,
split_part(tva_poste, ','::text, 1) AS tva_purchase,
split_part(tva_poste, ','::text, 2) AS tva_sale,
tva_both_side,
tva_payment_purchase,
tva_payment_sale
FROM public.tva_rate;

View file

@ -9,7 +9,7 @@ export TEMPLATE=${DOMAIN}mod2
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
pg_dump -Ox -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql
@ -17,5 +17,5 @@ sed -ne '/ADD CONSTRAINT/,$p' schema.sql |sed -e '1d' > constraint.sql
cp tmpSchema.sql schema.sql
echo "set search_path = public,comptaproc,pg_catalog ;" > data.sql
pg_dump -O -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql
pg_dump -Ox -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql

View file

@ -2,7 +2,28 @@
//This file is part of NOALYSS and is under GPL
//see licence.txt
/**
* Called from Acc_Ledger_Search
* @var $this Acc_Ledger_Search
* @var $f_ledger ICheckBox inherited Acc_Ledger_Search
* @var $hid_jrn html string : hidden r_jrn from previous request inherited
* @var $f_date_start IDate inherited
* @var $f_date_end IDate inherited
* @var $f_date_paid_start IDate inherited
* @var $f_date_paid_end IDate inherited
* @var $date_start_hidden IDate inherited
* @var $date_end_hidden IDate inherited
* @var $f_amount_min INum inherited
* @var $f_amount_max INum inherited
* @var $f_accounting IPoste inherited
* @var $g_parameter Noalyss_Parameter_Folder global variable
* @var $tva_id_search ITva_Popup inherited
* @var $f_paid ISelect inherited
* @var $sCurrency Acc_Currency inherited
* @var $http HttpInput inherited
*/
?>
<table id="<?=$this->div?>table_search">
<tr>

View file

@ -0,0 +1 @@
ALTER TABLE public.todo_list ALTER COLUMN tl_date drop NOT NULL;

View file

@ -33,7 +33,7 @@ use PHPUnit\Framework\TestCase;
*/
require DIRTEST.'/global.php';
class Acc_Letter extends TestCase
class Acc_LetterTest extends TestCase
{
/**
* @var Fiche