Manage code rewriting

This commit is contained in:
sparkyx 2025-08-19 13:31:11 +02:00
parent 99067ed2e1
commit aace9db326
17 changed files with 304 additions and 287 deletions

View file

@ -994,7 +994,7 @@ function add_category(obj)
*/ */
function save_card_category(obj) function save_card_category(obj)
{ {
if ( ! document.getElementById(obj).ipopup) if ( ! $(obj).ipopup)
{ {
alert_box('Erreur pas d\' attribut ipopup '+obj.id); alert_box('Erreur pas d\' attribut ipopup '+obj.id);
return; return;
@ -1010,14 +1010,28 @@ try {
var action=new Ajax.Request ( 'ajax_misc.php', var action=new Ajax.Request ( 'ajax_misc.php',
{ {
method:'get', method:'POST',
parameters:queryString, parameters:queryString,
onFailure:errorFid, onFailure:errorFid,
onSuccess:fill_box onSuccess:function (req)
{
fill_box(req);
// populate
var answer = req.responseXML;
var a = answer.getElementsByTagName('id');
var b = answer.getElementsByTagName('name');
if ( a.length == 1 && b.length == 1) {
let option=new Element('option');
option.value=getNodeText(a[0]);
option.text=getNodeText(b[0]);
id$('cat').add(option);
}
}
} }
); );
} catch(e) } catch(e)
{ {
alert_box(e.message); alert_box(e.message);
return false; return false;
} }

View file

@ -2223,7 +2223,7 @@ function filter_table(phrase, _id, colnr, start_row) {
if (tot_found == 0) { if (tot_found == 0) {
if (document.getElementById('info_' + _id)) { if (document.getElementById('info_' + _id)) {
id$('info_' + _id).innerHTML = content[69]; id$('info_' + _id).innerHTML = content[69];
id$('info_' + _id).style.display = 'block'; id$('info_' + _id).style.display = 'inline-block';
} }
} else { } else {
if (document.getElementById('info_' + _id)) { if (document.getElementById('info_' + _id)) {

View file

@ -634,9 +634,9 @@ case 'scc':
{ {
$html=""; $html="";
$nom_mod=$http->get("nom_mod"); $nom_mod=$http->post("nom_mod");
$class_base=$http->get("class_base"); $class_base=$http->post("class_base");
$fd_description=$http->get("nom_mod"); $fd_description=$http->post("fd_description","string","");
if ( noalyss_strlentrim($nom_mod) != 0 ) if ( noalyss_strlentrim($nom_mod) != 0 )
{ {
$array=array("FICHE_REF"=>$cat, $array=array("FICHE_REF"=>$cat,
@ -644,7 +644,7 @@ case 'scc':
"class_base"=>$class_base, "class_base"=>$class_base,
"fd_description"=>$fd_description); "fd_description"=>$fd_description);
if ( isset ($_POST['create'])) $array['create']=1; if ( isset ($_POST['create'])) $array['create']="on";
$catcard=new Fiche_Def($cn); $catcard=new Fiche_Def($cn);
@ -661,6 +661,14 @@ case 'scc':
} }
else{ else{
$script="alert_box('"._('Catégorie sauvée')."');removeDiv('$ctl')"; $script="alert_box('"._('Catégorie sauvée')."');removeDiv('$ctl')";
// add code to update the SELECT in include/template/category_of_card.php
$catcard->get();
$extra = '<code2>'.
'<id>'.$catcard->id.'</id>'.
'<name>'. escape_xml($catcard->label).'</name>'.
'</code2>';
} }
$html.=create_script($script); $html.=create_script($script);

View file

@ -15,135 +15,96 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software * along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
// Copyright Author Dany De Bontridder danydb@aevalys.eu // Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\brief include from supplier.inc.php and concerned only the supplier card and /* !\brief include from supplier.inc.php and concerned only the supplier card and
* the supplier category * the supplier category
*/ */
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); if (!defined('ALLOWED'))
global $g_user , $http; die('Appel direct ne sont pas permis');
global $g_user, $http;
$low_action=$http->request('sb',"string",'list'); $low_action = $http->request('sb', "string", 'list');
/*! \file /* ! \file
* \brief Called from the module 'Gestion' to manage the supplier * \brief Called from the module 'Gestion' to manage the supplier
*/ */
$href=basename($_SERVER['PHP_SELF']); $href=NOALYSS_URL."/do.php";
// by default open liste // by default open liste
if ( $low_action == '' ) if ($low_action == '')
$low_action='list'; $low_action = 'list';
//----------------------------------------------------- //----------------------------------------new-------------
// Remove a card // Remove a card
//----------------------------------------------------- //-----------------------------------------------------
if ( isset($_POST['delete_card'] ) ) if (isset($_POST['delete_card'])) {
{ if ($g_user->check_action(FICADD) == 0) {
if ( $g_user->check_action(FICADD) == 0 )
{
alert(_('Vous ne pouvez pas enlever de fiche')); alert(_('Vous ne pouvez pas enlever de fiche'));
return; return;
} }
$f_id = $http->request('f_id','number'); $f_id = $http->request('f_id', 'number');
$fiche=new Bank($cn,$f_id); $fiche = new Bank($cn, $f_id);
$fiche->remove(); $fiche->remove();
$low_action="list"; $low_action = "list";
} }
//----------------------------------------------------- //-----------------------------------------------------
// list of supplier // list of supplier
//----------------------------------------------------- //-----------------------------------------------------
if ( $low_action == "list" ) if ($low_action == "list") {
{
?> ?>
<div class="content"> <div class="content">
<div> <div>
<form method="get" action="<?php echo $href; ?>"> <?php
<?php Bank::form_search($href, FICHE_TYPE_FIN);
echo dossier::hidden(); ?>
echo '<h2 class="h-section">' ._( "Exercice")." " . $g_user->get_exercice() . '</h2>';
$a=$http->get("query","string","");
echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a);
$choice_cat=$http->request("choice_cat", "string",1);
if ( $choice_cat == 1 )
{
$sel_card=new ISelect('cat');
$sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
' where frd_id=$1'.
' order by fd_label ',1,array(FICHE_TYPE_FIN));
$sel_card->selected=$http->get("cat","number",-1);
$sel_card->javascript=' onchange="waiting_box();submit(this);"';
echo _('Catégorie :').$sel_card->input();
}
else
{
$cat=$http->request('cat',"string", '');
echo HtmlInput::hidden("cat", $cat);
echo HtmlInput::hidden('choice_cat', 0);
}
$nooperation=new ICheckBox('noop');
$nooperation->selected=(isset($_GET['noop']))?true:false;
echo _('Inclure les banques sans opération :').$nooperation->input();
?>
<input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
<input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
</form>
</div> </div>
<?php <?php
$supplier=new Bank($cn); $supplier = new Bank($cn);
$search=$http->get("query","string",""); $search = $http->get("query", "string", "");
$sql=""; $sql = "";
if ( isset($_GET['cat'])) if (isset($_GET['cat'])) {
{ $cat = $http->get("cat", "number");
$cat=$http->get("cat","number"); if ($cat != -1)
if ($cat!= -1 ) $sql = sprintf(" and fd_id = %s", $cat); $sql = sprintf(" and fd_id = %s", $cat);
} }
$noop=(isset($_GET['noop']))?false:true; $noop = (isset($_GET['noop'])) ? false : true;
echo '<div class="content">'; echo '<div class="content">';
echo $supplier->Summary($search,'bank',$sql,$noop); echo $supplier->Summary($search, 'bank', $sql, $noop);
echo '<br>'; echo '<br>';
echo '<br>'; echo '<br>';
echo '<br>'; echo '<br>';
if ($g_user->check_action(FICADD)==1) if ($g_user->check_action(FICADD) == 1) {
{
/* Add button */ /* Add button */
$f_add_button=new IButton('add_card'); $f_add_button = new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche'); $f_add_button->label = _('Créer une nouvelle fiche');
$f_add_button->set_attribute('win_refresh','yes'); $f_add_button->set_attribute('win_refresh', 'yes');
$f_add_button->set_attribute('type_cat',FICHE_TYPE_FIN); $f_add_button->set_attribute('type_cat', FICHE_TYPE_FIN);
$f_add_button->javascript=" select_card_type(this);"; $f_add_button->javascript = " select_card_type(this);";
echo $f_add_button->input(); echo $f_add_button->input();
$f_cat_button=new IButton('add_cat'); $f_cat_button = new IButton('add_cat');
$f_cat_button->set_attribute('type_cat',FICHE_TYPE_FIN); $f_cat_button->set_attribute('type_cat', FICHE_TYPE_FIN);
$f_cat_button->set_attribute('ipopup','ipop_cat'); $f_cat_button->set_attribute('ipopup', 'ipop_cat');
$f_cat_button->label=_('Ajout d\'une catégorie'); $f_cat_button->label = _("Ajout d'une catégorie");
$f_cat_button->javascript='add_category(this)'; $f_cat_button->javascript = 'add_category(this)';
echo $f_cat_button->input(); echo $f_cat_button->input();
} }
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
} }
/*---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* Detail for a card, Suivi, Contact, Operation,... * * Detail for a card, Suivi, Contact, Operation,... *
* cc stands for supplier card * cc stands for supplier card
*----------------------------------------------------------------------*/ * ---------------------------------------------------------------------- */
if ( $low_action == 'detail') if ($low_action == 'detail') {
{
/* Menu */ /* Menu */
require_once('category_card.inc.php'); require_once('category_card.inc.php');
return; return;

View file

@ -33,11 +33,9 @@ require_once NOALYSS_INCLUDE.'/lib/user_common.php';
class Bank extends Fiche class Bank extends Fiche
{ {
var $name; /*!< $name name of the company */
var $street; /*!< $street Street */
var $country; /*!< $country Country */ use Trait_Card;
var $cp; /*!< $cp Zip code */
var $vat_number; /*!< $vat_number vat number */
/*! \brief Constructor only a db connection is needed */ /*! \brief Constructor only a db connection is needed */
function __construct($p_cn,$p_id=0) function __construct($p_cn,$p_id=0)

View file

@ -37,7 +37,7 @@ class Customer extends Fiche
var $country; /*!< $country Country */ var $country; /*!< $country Country */
var $cp; /*!< $cp Zip code */ var $cp; /*!< $cp Zip code */
var $vat_number; /*!< $vat_number vat number */ var $vat_number; /*!< $vat_number vat number */
use Trait_Card;
/*! \brief Constructor /*! \brief Constructor
* only a db connection is needed * only a db connection is needed
*/ */

View file

@ -39,10 +39,10 @@ class Fiche_Def
var $attribut; //!< get from attr_xxx tables var $attribut; //!< get from attr_xxx tables
var $fd_description; //!< Description of the Card Category var $fd_description; //!< Description of the Card Category
function __construct($p_cn,$p_id = 0) function __construct($cn,$id = 0)
{ {
$this->cn=$p_cn; $this->cn=$cn;
$this->id=$p_id; $this->id=$id;
} }
@ -61,7 +61,7 @@ class Fiche_Def
} }
/** /**
* @brief replace by load_attribute * @brief replace by load_attribute
* @deprecated since version 9.3.0.12 * @deprecated since version 9.3.12
* @return type * @return type
*/ */
function getAttribut() { function getAttribut() {

View file

@ -39,7 +39,7 @@ class Manager extends Fiche
var $country; /*!< $country Country */ var $country; /*!< $country Country */
var $cp; /*!< $cp Zip code */ var $cp; /*!< $cp Zip code */
var $vat_number; /*!< $vat_number vat number */ var $vat_number; /*!< $vat_number vat number */
use Trait_Card;
/*! \brief Constructor /*! \brief Constructor
* only a db connection is needed */ * only a db connection is needed */
function __construct($p_cn,$p_id=0) function __construct($p_cn,$p_id=0)

View file

@ -26,7 +26,7 @@ require_once NOALYSS_INCLUDE.'/lib/user_common.php';
* \brief class Supplier are a specific kind of card * \brief class Supplier are a specific kind of card
*/ */
// Use the view vw_supplier ///@brief Use the view vw_supplier and the trait Trait_Card
// //
class Supplier extends Fiche class Supplier extends Fiche
{ {
@ -38,6 +38,9 @@ class Supplier extends Fiche
var $cp; /*!< $cp Zip code */ var $cp; /*!< $cp Zip code */
var $vat_number; /*!< $vat_number vat number */ var $vat_number; /*!< $vat_number vat number */
use Trait_Card;
/*! \brief Constructor /*! \brief Constructor
* only a db connection is needed */ * only a db connection is needed */
function __construct($p_cn,$p_id=0) function __construct($p_cn,$p_id=0)

View file

@ -0,0 +1,46 @@
<?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 22/10/23
/**
* @file
* @brief Contains function used by object Customer , Supplier, Bank, ... that
* are derivated from Fiche
*/
/**
* @class
* @brief Contains function used by object Customer , Supplier, Bank, ... that
* are derivated from Fiche
*/
trait Trait_Card {
/**
* @brief For the follow-up module for customer, supplier, ... display a
* filter
* @param $url (string URL) url with folder id, access code ,...
* @param $type_card (int) category of card see FICHE_TYPE_* in
* include/constant.php
*/
public static function form_search($url,$type_card)
{
require_once NOALYSS_TEMPLATE."/trait_card-form_search.php";
}
}

View file

@ -368,6 +368,7 @@ define("ARROWUP","&#8679;");
// Url of NOALYSS (http://...) // Url of NOALYSS (http://...)
// //
if (!defined("NOALYSS_URL")) { if (!defined("NOALYSS_URL")) {
if ( isset ( $_SERVER)) {
$protocol = "http"; $protocol = "http";
if (isset ($_SERVER['REQUEST_SCHEME'])) { if (isset ($_SERVER['REQUEST_SCHEME'])) {
$protocol = $_SERVER['REQUEST_SCHEME']; $protocol = $_SERVER['REQUEST_SCHEME'];
@ -377,6 +378,9 @@ if (!defined("NOALYSS_URL")) {
":" . $_SERVER['SERVER_PORT'] . ":" . $_SERVER['SERVER_PORT'] .
dirname($_SERVER['PHP_SELF']); dirname($_SERVER['PHP_SELF']);
define("NOALYSS_URL", $base); define("NOALYSS_URL", $base);
}else {
define("NOALYSS_URL","command-line");
}
} }
if (!defined("DEFAULT_SERVER_VIDEO_CONF")) { if (!defined("DEFAULT_SERVER_VIDEO_CONF")) {
define("DEFAULT_SERVER_VIDEO_CONF", "https://www.free-solutions.org/"); define("DEFAULT_SERVER_VIDEO_CONF", "https://www.free-solutions.org/");
@ -400,6 +404,7 @@ function noalyss_class_autoloader($class)
} }
$aClass = array( $aClass = array(
"trait_card"=>"class/trait_card.php",
"database" => "class/database.class.php", "database" => "class/database.class.php",
"acc_detail" => "class/acc_operation.class.php", "acc_detail" => "class/acc_operation.class.php",
"acc_sold" => "class/acc_operation.class.php", "acc_sold" => "class/acc_operation.class.php",

View file

@ -66,38 +66,11 @@ if ($low_action == "list")
?> ?>
<div class="content"> <div class="content">
<div> <div>
<form method="get" action="<?php echo $href;?>">
<?php <?php
echo '<h2 class="h-section">' . "Exercice " . $g_user->get_exercice() . '</h2>';
$a=$http->get("query","string","");
echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a);
$choice_cat=$http->request("choice_cat", "string",1); Customer::form_search($href, FICHE_TYPE_CLIENT);
if ( $choice_cat == 1 )
{
$sel_card=new ISelect('cat');
$sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
' where frd_id='.FICHE_TYPE_CLIENT.
' order by fd_label ',1);
$sel_card->selected=$http->get("cat","number",-1);
$sel_card->javascript=' onchange="waiting_box();submit(this);"';
echo _('Catégorie :').$sel_card->input();
} else
{
$cat=$http->request('cat',"string", '');
echo HtmlInput::hidden("cat",$cat);
echo HtmlInput::hidden('choice_cat', 0);
}
$nooperation = new ICheckBox('noop');
$nooperation->selected = (isset($_GET['noop'])) ? true : false;
echo Dossier::hidden();
echo _('Inclure les clients sans opération :') . $nooperation->input();
?> ?>
<input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
<input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
</form>
</div> </div>
<?php <?php
$client = new Customer($cn); $client = new Customer($cn);

View file

@ -1066,7 +1066,6 @@ function find_default_module()
/** /**
* @brief show the module * @brief show the module
* @var $g_user
* @param $module the $_REQUEST['ac'] exploded into an array * @param $module the $_REQUEST['ac'] exploded into an array
* @param $idx the index of the array : the AD code is splitted into an array thanks the slash * @param $idx the index of the array : the AD code is splitted into an array thanks the slash
*/ */

View file

@ -1030,7 +1030,7 @@ class HtmlInput
<input type=\"button\" class=\"smallbutton\" onclick=\"$('lk_".$p_table_id."').value='';filter_table($('lk_".$p_table_id."'), '$p_table_id','$p_col',$start_row );\" value=\"X\"> <input type=\"button\" class=\"smallbutton\" onclick=\"$('lk_".$p_table_id."').value='';filter_table($('lk_".$p_table_id."'), '$p_table_id','$p_col',$start_row );\" value=\"X\">
</span> </span>
"; ";
$r.=' <span class="notice" id="info_'.$p_table_id.'"></span>'; $r.=' <span class="notice" style="display:none" id="info_'.$p_table_id.'"></span>';
return $r; return $r;
} }
/** /**

View file

@ -65,38 +65,9 @@ if ($low_action == "list")
?> ?>
<div class="content"> <div class="content">
<div> <div>
<form method="get" action="<?php echo $href; ?>">
<?php <?php
echo '<h2 class="h-section">' . "Exercice " . $g_user->get_exercice() . '</h2>'; Manager::form_search($href, FICHE_TYPE_EMPL);
echo dossier::hidden();
$a=$http->get("query","string","");
echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a);
echo HtmlInput::request_to_hidden(array('ac'));
$choice_cat=$http->request("choice_cat", "number",1);
if ( $choice_cat == 1 )
{
$sel_card = new ISelect('cat');
$sel_card->value = $cn->make_array('select fd_id, fd_label from fiche_def ' .
' where frd_id=' . FICHE_TYPE_EMPL .
' order by fd_label ', 1);
$sel_card->selected=$http->get("cat","number",-1);
$sel_card->javascript = ' onchange="waiting_box();submit(this);"';
echo _('Catégorie :') . $sel_card->input();
}
else
{
$cat=$http->request('cat',"string", '');
echo HtmlInput::hidden("cat",$cat);
echo HtmlInput::hidden('choice_cat', 0);
}
$nooperation = new ICheckBox('noop');
$nooperation->selected = (isset($_GET['noop'])) ? true : false;
echo _('Inclure les employés sans opération :') . $nooperation->input();
?> ?>
<input type="submit" class="button" name="submit_query" value="<?php echo _('recherche') ?>">
<input type="hidden" name="ac" value="<?php echo$http->request('ac') ?>">
</form>
</div> </div>
<?php <?php
$supplier = new Manager($cn); $supplier = new Manager($cn);

View file

@ -15,141 +15,104 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software * along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
// Copyright Author Dany De Bontridder danydb@aevalys.eu // Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\brief include from supplier.inc.php and concerned only the supplier card and /* !\brief include from supplier.inc.php and concerned only the supplier card and
* the supplier category * the supplier category
*/ */
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); if (!defined('ALLOWED'))
global $g_user,$http; die('Appel direct ne sont pas permis');
global $g_user, $http;
$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list"; $low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
/*! \file /* ! \file
* \brief Called from the module "Gestion" to manage the supplier * \brief Called from the module "Gestion" to manage the supplier
*/ */
$href=basename($_SERVER['PHP_SELF']); $href = basename($_SERVER['PHP_SELF']);
// by default open liste // by default open liste
if ( $low_action == "" ) if ($low_action == "")
$low_action="list"; $low_action = "list";
//----------------------------------------------------- //-----------------------------------------------------
// Remove a card // Remove a card
//----------------------------------------------------- //-----------------------------------------------------
if ( isset($_POST['action_fiche'] ) ) if (isset($_POST['action_fiche'])) {
{ if ($_POST['action_fiche'] == 'delete_card') {
if ( $_POST['action_fiche'] == 'delete_card') if ($g_user->check_action(FICADD) == 0) {
{
if ( $g_user->check_action(FICADD) == 0 )
{
alert(_('Vous ne pouvez pas enlever de fiche')); alert(_('Vous ne pouvez pas enlever de fiche'));
return; return;
} }
$f_id = $http->request('f_id','number'); $f_id = $http->request('f_id', 'number');
$fiche=new Supplier($cn,$f_id); $fiche = new Supplier($cn, $f_id);
$fiche->remove(); $fiche->remove();
$low_action="list"; $low_action = "list";
} }
} }
//----------------------------------------------------- //-----------------------------------------------------
// list of supplier // list of supplier
//----------------------------------------------------- //-----------------------------------------------------
if ( $low_action == "list" ) if ($low_action == "list") {
{ $search = $http->get("query", "string", "");
$search=$http->get("query","string","");
?> ?>
<div class="content"> <div class="content">
<div> <div>
<form method="get" action="<?php echo $href; ?>">
<?php <?php
echo '<h2 class="h-section">' . "Exercice " . $g_user->get_exercice() . '</h2>'; Supplier::form_search($href, FICHE_TYPE_FOURNISSEUR);
echo dossier::hidden();
echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$search);
$choice_cat=$http->request("choice_cat", "string",1);
if ( $choice_cat == 1 )
{
$sel_card=new ISelect('cat');
$sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
' where frd_id='.FICHE_TYPE_FOURNISSEUR.
' order by fd_label ',1);
$sel_card->selected=$http->get("cat","number",-1);
$sel_card->javascript=' onchange="waiting_box();submit(this);"';
echo _('Catégorie :').$sel_card->input();
} else
{
$cat=$http->request('cat','string', '');
echo HtmlInput::hidden("cat",$cat);
echo HtmlInput::hidden('choice_cat', 0);
}
$nooperation=new ICheckBox('noop');
$nooperation->selected=(isset($_GET['noop']))?true:false;
echo _('Inclure les fournisseurs sans opération :').$nooperation->input();
?> ?>
<input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
<input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
</form>
</div> </div>
<?php <?php
$supplier=new Supplier($cn); $supplier = new Supplier($cn);
$sql=""; $sql = "";
if (isset($_GET['cat'])) if (isset($_GET['cat'])) {
{ $cat = $http->get("cat", "number");
$cat=$http->get("cat","number"); if ($cat != -1)
if ($cat!= -1)
$sql = sprintf(" and fd_id = %s", $cat); $sql = sprintf(" and fd_id = %s", $cat);
} }
$noop=(isset($_GET['noop']))?false:true; $noop = (isset($_GET['noop'])) ? false : true;
echo '<div class="content">'; echo '<div class="content">';
echo $supplier->Summary($search,'supplier',$sql,$noop); echo $supplier->Summary($search, 'supplier', $sql, $noop);
echo '<br>'; echo '<br>';
echo '<br>'; echo '<br>';
echo '<br>'; echo '<br>';
if ($g_user->check_action(FICADD)==1) if ($g_user->check_action(FICADD) == 1) {
{
/* Add button */ /* Add button */
$f_add_button=new IButton('add_card'); $f_add_button = new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche'); $f_add_button->label = _('Créer une nouvelle fiche');
$f_add_button->set_attribute('win_refresh','yes'); $f_add_button->set_attribute('win_refresh', 'yes');
$f_add_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR); $f_add_button->set_attribute('type_cat', FICHE_TYPE_FOURNISSEUR);
$f_add_button->javascript=" select_card_type(this);"; $f_add_button->javascript = " select_card_type(this);";
echo $f_add_button->input(); echo $f_add_button->input();
$f_cat_button=new IButton('add_cat'); $f_cat_button = new IButton('add_cat');
$f_cat_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR); $f_cat_button->set_attribute('type_cat', FICHE_TYPE_FOURNISSEUR);
$f_cat_button->set_attribute('ipopup','ipop_cat'); $f_cat_button->set_attribute('ipopup', 'ipop_cat');
$f_cat_button->label=_('Ajout d\'une catégorie'); $f_cat_button->label = _('Ajout d\'une catégorie');
$f_cat_button->javascript='add_category(this)'; $f_cat_button->javascript = 'add_category(this)';
echo $f_cat_button->input(); echo $f_cat_button->input();
} }
echo '</div>'; echo '</div>';
echo '</div>'; echo '</div>';
}
/* ----------------------------------------------------------------------
}
/*----------------------------------------------------------------------
* Detail for a card, Suivi, Contact, Operation,... * * Detail for a card, Suivi, Contact, Operation,... *
* cc stands for supplier card * cc stands for supplier card
*----------------------------------------------------------------------*/ * ---------------------------------------------------------------------- */
if ( $low_action == 'detail') if ($low_action == 'detail') {
{
/* Menu */ /* Menu */
require_once NOALYSS_INCLUDE.'/category_card.inc.php'; require_once NOALYSS_INCLUDE . '/category_card.inc.php';
return; return;
} }
html_page_stop(); html_page_stop();
?> ?>

View file

@ -0,0 +1,76 @@
<?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 22/10/23
/**
* @file
* @brief answer to an inplace object
*/
// var $g_user \Noalyss_User connected user
global $g_user;
// var $type_card = FICHE_TYPE_CLIENT, FICHE_TYPE_FOURNISSEUR,...
// var $cn Dossier connect to the current folder
$cn = Dossier::connect();
$http = new HttpInput();
?>
<form method="get" action="<?php echo $url; ?>">
<h2 class="h-section"><?= sprintf("%s %s", _("Exercice"), $g_user->get_exercice()) ?></h2>
<div style="display:flex">
<div>
<?php
$a = $http->get("query", "string", "");
echo _("Cherche ") . HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1, "query", $a);
$choice_cat = $http->request("choice_cat", "string", 1);
?>
</div>
<?php
if ($choice_cat == 1) {
$sel_card = new ISelect('cat');
$sel_card->value = $cn->make_array('select fd_id, fd_label from fiche_def
where frd_id= $1
order by fd_label ', 1, [$type_card]);
$sel_card->selected = $http->get("cat", "number", -1);
$sel_card->javascript = ' onchange="waiting_box();submit(this);"';
echo '<div>';
echo _('Catégorie :') . $sel_card->input();
echo '</div>';
} else {
$cat = $http->request('cat', "string", '');
echo HtmlInput::hidden("cat", $cat);
echo HtmlInput::hidden('choice_cat', 0);
}
$nooperation = new ICheckBox('noop');
$nooperation->selected = (isset($_GET['noop'])) ? true : false;
echo Dossier::hidden();
?>
<div>
<?= _('Inclure ceux sans opération cette année') . $nooperation->input() ?>
</div>
<div>
<input type="submit" class="button" name="submit_query" value="<?php echo _('recherche') ?>">
<input type="hidden" name="ac" value="<?php echo $http->request('ac') ?>">
</div>
</div>
</form>