From 23b88e2bb889991c41a5b64dbae228ddac1ff186 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 18 Aug 2020 19:11:23 +0200 Subject: [PATCH 01/65] reconcilaction : possibility to select only one operation --- html/js/scripts.js | 12 ++- include/ajax/ajax_search_operation.php | 3 + include/class/acc_ledger_search.class.php | 3 + include/lib/iconcerned.class.php | 100 +++++++++++++------- unit-test/include/class/acc_ledger.Test.php | 65 +++++++++---- 5 files changed, 125 insertions(+), 58 deletions(-) diff --git a/html/js/scripts.js b/html/js/scripts.js index 404e99eff..ce350f34b 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1304,6 +1304,7 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target, str_style += ";width:92%;overflow:auto;"; waiting_box(); var hide_operation = $(ctl_concern).getAttribute("hide_operation"); + var single_operation = $(ctl_concern).getAttribute("single_operation"); var param_send = {gDossier: dossier, ctlc: ctl_concern, @@ -1313,7 +1314,8 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target, ledger: ledger, target: target, tiers: tiers, - hide_operation: hide_operation + hide_operation: hide_operation, + single_operation:single_operation }; var qs = encodeJSON(param_send); @@ -1381,6 +1383,7 @@ function set_reconcile(obj) if (!obj.elements['target']) return; var target = obj.elements['target'].value; + var single_operation = obj.elements['single_operation'].value; for (var e = 0; e < obj.elements.length; e++) { @@ -1414,7 +1417,12 @@ function set_reconcile(obj) }); } } - $(ctlc.value).value += nValue; + if (single_operation==0) { + $(ctlc.value).value += nValue; + } else { + $(ctlc.value).value = nValue; + + } } } } diff --git a/include/ajax/ajax_search_operation.php b/include/ajax/ajax_search_operation.php index 0c4701187..f5a541ac4 100644 --- a/include/ajax/ajax_search_operation.php +++ b/include/ajax/ajax_search_operation.php @@ -109,6 +109,8 @@ if (isset($_GET['viewsearch'])) list($array['date_start'], $array['date_end'])=$g_user->get_limit_current_exercice(); } $array['hide_operation']=$hide_operation; + $array['single_operation']=$http->get("single_operation"); + list($sql, $where)=$ledger->build_search_sql($array); // Count nb of line $max_line=$cn->count_sql($sql); @@ -128,6 +130,7 @@ if (isset($_GET['viewsearch'])) } } echo '
'; + echo HtmlInput::hidden("single_operation", $array['single_operation']); echo HtmlInput::hidden("tiers", $tiers); echo HtmlInput::submit("upd_rec", _("Mettre à jour")); echo HtmlInput::get_to_hidden(array('ctlc', 'amount_id', 'ledger')); diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php index 198b0e7ac..d2e7fa76e 100644 --- a/include/class/acc_ledger_search.class.php +++ b/include/class/acc_ledger_search.class.php @@ -224,6 +224,9 @@ class Acc_Ledger_Search if (isset($_REQUEST['hide_operation'])) $r.=HtmlInput::hidden("hide_operation", $http->request('hide_operation')); + if (isset($_REQUEST['single_operation'])) + $r.=HtmlInput::hidden("single_operation", $http->request('single_operation')); + ob_start(); $search_filter=$this->build_search_filter(); require_once NOALYSS_TEMPLATE.'/ledger_search.php'; diff --git a/include/lib/iconcerned.class.php b/include/lib/iconcerned.class.php index d43fa3e4c..2c4a4187f 100644 --- a/include/lib/iconcerned.class.php +++ b/include/lib/iconcerned.class.php @@ -1,4 +1,5 @@ name=$p_name; - $this->value=$p_value; - $this->amount_id=null; - $this->paid=''; - $this->id=$p_id; - $this->tiers=""; // id of the field for the tiers to be updated - $this->div=""; // Dom Element to show the search result - $this->hideOperation=""; // string of j_id to hide, separated by comma to avoid to reconcile an operation with itself - } - /*!\brief show the html input of the widget*/ - public function input($p_name=null,$p_value=null) + private $hideOperation; //!< string of j_id to hide, separated by comma to avoid to reconcile an operation with itself + private $singleOperation; //!< do not allow to select several operations + + public function __construct($p_name='', $p_value='', $p_id="") + { + $this->name=$p_name; + $this->value=$p_value; + $this->amount_id=null; + $this->paid=''; + $this->id=$p_id; + // id of the field for the tiers to be updated + $this->tiers=""; + // Dom Element to show the search result + $this->div=""; + // string of j_id to hide, separated by comma to avoid to reconcile an operation with itself + $this->hideOperation=""; + // by default we can select several operation + $this->singleOperation=0; + } + + /* !\brief show the html input of the widget */ + + public function input($p_name=null, $p_value=null) { $this->name=($p_name==null)?$this->name:$p_name; $this->value=($p_value==null)?$this->value:$p_value; - if ( $this->readOnly==true) return $this->display(); + if ($this->readOnly==true) + return $this->display(); $this->id=($this->id=="")?$this->name:$this->id; - $javascript=sprintf("search_reconcile(".dossier::id().",'%s','%s','%s','%s','%s')", - $this->name, - $this->amount_id, - $this->paid, - $this->div, - $this->tiers ); + $javascript=sprintf("search_reconcile(".dossier::id().",'%s','%s','%s','%s','%s')", $this->name, + $this->amount_id, $this->paid, $this->div, $this->tiers); $r=Icon_Action::icon_magnifier(uniqid(), $javascript); $r.=sprintf(" - + - ", - $this->name, - $this->id, - $this->value, - $this->hideOperation, - $this->id - ); + ", $this->name, $this->id, $this->value, $this->hideOperation,$this->singleOperation, + $this->id + ); return $r; } /** * setter - * @param $p_string + * @param number $p_string jrn.jr_id of the operation to hide */ function set_hideOperation($p_string) { $this->hideOperation=strip_tags($p_string); } - /*!\brief print in html the readonly value of the widget*/ + + /** + * Set the value of single operation, limit to one operation if TRUE + * @param bool $p_value TRUE or false + */ + function set_singleOperation($p_value){ + if ( $p_value == TRUE ) { + $this->singleOperation=1; + return; + } + if ( $p_value == FALSE ) { + $this->singleOperation=0; + return; + } + throw new Exception (_("setSingleOperation failed")); + } + + function get_singleOperation(){ + return $this->singleOperation; + } + + /* !\brief print in html the readonly value of the widget */ + public function display() { - $r=sprintf("%s",$this->value); - $r.=sprintf('', $this->name,$this->value); + $r=sprintf("%s", $this->value); + $r.=sprintf('', $this->name, $this->value); return $r; - } + static public function test_me() { + } + } diff --git a/unit-test/include/class/acc_ledger.Test.php b/unit-test/include/class/acc_ledger.Test.php index 93e8af5bc..8edb68d36 100644 --- a/unit-test/include/class/acc_ledger.Test.php +++ b/unit-test/include/class/acc_ledger.Test.php @@ -443,31 +443,56 @@ class Acc_LedgerTest extends TestCase */ public function testVerify_Ledger() { - global $g_connection; + global $g_connection; $ledger=new Acc_Ledger($g_connection,4); $array=[ - "p_jrn"=>"15", - "p_jrn_deb_max_line"=>5, - "p_jrn_name"=>"New ledger", - "p_jrn_type"=>"ODS" - ]; - // Must success - try { - $ledger->verify_ledger($array); - $this->assertTrue(TRUE); - } catch (Exception $ex) { - var_dump($ex->getMessage()); - var_dump($ex->getTraceAsString()); - } + "p_jrn"=>"15", + "p_jrn_deb_max_line"=>5, + "p_jrn_name"=>"New ledger", + "p_jrn_type"=>"ODS" + ]; + //----------------------------------------------- + // Must succeed + //----------------------------------------------- + $ledger->verify_ledger($array); + + // succeeds if negative amount 1 + $array["negative_amount"]=1; + $ledger->verify_ledger($array); + + //----------------------------------------------- // Must fail - $a_ledger["p_jrn"]="a"; + //----------------------------------------------- try { - $ledger->verify_ledger($array); - $this->assertTrue(FALSE); - } catch (Exception $ex) { - $this->assertTrue(TRUE); - } + $array["p_jrn"]="a"; + $ledger->verify_ledger($array); + $this->assertTrue(FALSE,"p_jrn is invalide"); + }catch (\Exception $e) { + $this->assertTrue(TRUE); + } + // reset properly , + $array["p_jrn"]="15"; + $ledger->verify_ledger($array); + + + // fails if negative amount neither 1 nor 0 + try { + $array["negative_amount"]=2; + $ledger->verify_ledger($array); + $this->assertTrue(FALSE,"negative_amount must be 1 or 0"); + }catch (\Exception $e) { + $this->assertTrue(TRUE); + } + + // negative amount not set , so fails + try { + $array["negative_warning"]="Yes"; + $ledger->verify_ledger($array); + $this->assertTrue(FALSE,"negative_warning must be a string"); + }catch (\Exception $e) { + $this->assertTrue(TRUE); + } } /** From 5779e2f33c310baed5ea1639475a1a4b27a7ee08 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 18 Aug 2020 19:11:46 +0200 Subject: [PATCH 02/65] prevent divide by zero in formula --- include/lib/ac_common.php | 23 ++++++++++++++++++++--- include/lib/impress.class.php | 4 ++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 44ee884ad..ff0f1e8f2 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -209,13 +209,13 @@ function cmpDate($p_date, $p_date_oth) /***! * @brief check if the argument is a number * - * \param $p_int number to test + * @param $p_int number to test * - * \return + * @return * - 1 it's a number * - 0 it is not */ -function isNumber(&$p_int) +function isNumber($p_int) { if (strlen(trim($p_int)) == 0) return 0; @@ -1375,3 +1375,20 @@ function convert_to_rtf($p_string) } return $result; } +/** + * When it is needed to eval a formula , this function prevent the divide by zero. + * the formula is a math operation to evaluate like : 1.0+2.0/1 (...) , it is used in "report", + * it removes the operation "divide by 0 " + * + * @param string $p_formula string containing a operation to evaluate + * + * @see Impress::parse_formula + */ +function remove_divide_zero($p_formula) +{ + $test=str_replace(" ","",$p_formula).";"; + $p_formula=preg_replace("![0-9]+\.*[0-9]*/0\.{0,1}0*(\+|-|\*|/|;){1}!","0$1",$test); + $p_formula=trim($p_formula,';'); + return $p_formula; +} + diff --git a/include/lib/impress.class.php b/include/lib/impress.class.php index 0a8beb32b..8ea617f11 100644 --- a/include/lib/impress.class.php +++ b/include/lib/impress.class.php @@ -153,6 +153,10 @@ class Impress // $p_eval is true then we eval and returns result if ( $p_eval == true) { + /*------------------------------------- + * Protect againt division by zero + */ + $p_formula=remove_divide_zero($p_formula); $p_formula="\$result=".$p_formula.";"; eval("$p_formula"); From c91e64125a69a4ee4ee18a0119c6a69c2b48da7b Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 18 Aug 2020 19:12:29 +0200 Subject: [PATCH 03/65] remove extract --- include/class/acc_ledger.class.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 30df01e4d..877738b9e 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -2351,7 +2351,12 @@ class Acc_Ledger extends jrn_def_sql */ function verify_ledger($array) { - extract($array, EXTR_SKIP); + + $p_jrn=$array['p_jrn']; + $p_jrn_deb_max_line=$array['p_jrn_deb_max_line']; + $p_jrn_name=$array['p_jrn_name']; + $p_jrn_type=$array['p_jrn_type']; + try { if (isNumber($p_jrn)==0) @@ -2365,8 +2370,10 @@ class Acc_Ledger extends jrn_def_sql throw new Exception(_("Un journal avec ce nom existe déjà")); if ($p_jrn_type=='FIN') { + $http=new \HttpInput(); $a=new Fiche($this->db); - $result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])), false); + $bank=$http->post("bank"); + $result=$a->get_by_qcode(trim(strtoupper($bank)), false); if ($result==1) throw new Exception(_("Aucun compte en banque n'est donné")); } @@ -2375,11 +2382,17 @@ class Acc_Ledger extends jrn_def_sql throw new Exception(_('Choix du type de journal est obligatoire')); } - if (isset( $negative_warning) && $negative_amount == 1 && trim($negative_warning)=="") { + if ( isset( $array['negative_warning']) && + isset( $array['negative_amount']) && + $array['negative_amount'] == 1 + && trim($array['negative_warning'])=="") { throw new Exception(_("Avertissement ne peut être vide")); } - if ( isset( $negative_amount) && $negative_amount <> 0 && $negative_amount <> 1 ){ + if ( isset( $array['negative_amount']) && + $array['negative_amount'] <> 0 && + $array['negative_amount'] <> 1 ) + { throw new Exception(_("Valeur invalide")); } } From 7f6ae783af0fbc39fcb23147bea4e5c042944193 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 19 Aug 2020 17:24:27 +0200 Subject: [PATCH 04/65] compatibility PHP74 : join() : glue before piece --- include/class/acc_ledger_history_generic.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php index 54ee8312b..a50f142d8 100644 --- a/include/class/acc_ledger_history_generic.class.php +++ b/include/class/acc_ledger_history_generic.class.php @@ -494,7 +494,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History $cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:""; - $ledger_list=join($this->ma_ledger, ","); + $ledger_list=join( ",",$this->ma_ledger); // Grand livre == 0 $Res=$this->db->exec_sql("select jr_id,j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date, jr_internal, From 03ad5cd3fd76fb7f6a5830855c15cc0ca36cec90 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Thu, 27 Aug 2020 20:31:23 +0200 Subject: [PATCH 05/65] Fix bug : cannot use % when searching NEW : space can be used now --- html/js/card.js | 2 ++ include/ajax/ajax_card.php | 8 +++++--- include/class/fiche.class.php | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/html/js/card.js b/html/js/card.js index 8c7b918ad..6212658a0 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -274,7 +274,9 @@ function search_get_card(obj) } else { queryString+="&accvis=0"; } + queryString=encodeURI(queryString); $('asearch').innerHTML=loading(); + var action=new Ajax.Request ( 'ajax_misc.php', { method:'get', diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 9b61631ba..74a3d5b8f 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -441,7 +441,7 @@ case 'fs': $r.=''; $r.=dossier::hidden().HtmlInput::hidden('op','fs'); $array=array(); - foreach (array('accvis','query','inp','jrn','label','typecard','price','tvaid') as $i) + foreach (array('accvis','inp','jrn','label','typecard','price','tvaid') as $i) { if (isset(${$i}) ) { @@ -449,6 +449,7 @@ case 'fs': $sql_array[$i]=${$i}; } } + $sql_array["query"]=$query; /* what is the type of the ledger */ $type="GL"; if (isset($jrn) && $jrn > 1) @@ -462,12 +463,13 @@ case 'fs': if ( strpos($sql," in ()") != 0) { - $html=Icon_Action::close('search_card'); - $html.='
'.h2info(_('Recherche de fiche')).'
'; + $html=""; + $html.=HtmlInput::title_box(_('Recherche de fiche'), 'search_card'); $html.='

'; $html.=_("Aucune catégorie de fiche ne correspond à". " votre demande, le journal pourrait n'avoir accès à aucune fiche"); $html.='

'; + $html.=HtmlInput::button_close("search_card"); break; } /* We limit the search to MAX_SEARCH_CARD records */ diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 876351e36..565612c87 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -2131,8 +2131,9 @@ class Fiche { $query=sql_string($query); - if (strlen(trim($query))>1) + if (strlen(trim($query))>0) { + $query=str_replace(" ", "%", $query); $filter_query=$and."(vw_name ilike '%$query%' or quick_code ilike ('%$query%') " ." or vw_description ilike '%$query%' or tva_num ilike '%$query%' or accounting like upper('$query%'))"; } From 455a072e272683aaea36464885c7a4a91e95ace6 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Mon, 21 Sep 2020 22:05:02 +0200 Subject: [PATCH 06/65] Improve use of the security --- html/style-classic7.css | 5 ++ include/ajax/ajax_get_profile.php | 5 +- include/class/extension.class.php | 6 ++ include/param_sec.inc.php | 74 ++++++++++++++--------- include/template/security_list_action.php | 3 +- 5 files changed, 62 insertions(+), 31 deletions(-) diff --git a/html/style-classic7.css b/html/style-classic7.css index 866f4d34a..56db14ecb 100644 --- a/html/style-classic7.css +++ b/html/style-classic7.css @@ -2469,3 +2469,8 @@ span.title_tab_row { color : white !important; } +p.info { + font-size:90%; + font-family: sans-serif; + font-style: italic; +} \ No newline at end of file diff --git a/include/ajax/ajax_get_profile.php b/include/ajax/ajax_get_profile.php index 586a92d66..9f92f8d2b 100644 --- a/include/ajax/ajax_get_profile.php +++ b/include/ajax/ajax_get_profile.php @@ -55,7 +55,7 @@ $a_tab[$call_tab]='tabs_selected';
  • -
  • +
  •   @@ -111,7 +111,6 @@ if ($profile->p_id > 0) echo ''; echo ''; echo ''; echo ' +
    +

    +
      +'; + + echo HtmlInput::hidden("cor_id[]", $aOption[$i]["cor_id"]); + $is=new InputSwitch("contact_option$i",$aOption[$i]["jdoc_enable"]); + echo $is->input(); + echo "   "._($aOption[$i]['cor_label']); + echo ''; +} +?> +
    +
    diff --git a/include/template/card_multiple_display_option.php b/include/template/card_multiple_display_option.php index 2b07f9e3b..309aa3754 100644 --- a/include/template/card_multiple_display_option.php +++ b/include/template/card_multiple_display_option.php @@ -79,6 +79,13 @@ if (!defined('ALLOWED')) } } break; + case 4: + $input=new InputSwitch("ap_value[]"); + if ( $a_option[$i]['ap_value'] =="") { + $a_option[$i]['ap_value']=0; + } + break; + } $input->set_value ($a_option[$i]['ap_value']); echo ''; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 6ee0d7ed2..50e61a794 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -5,3 +5,14 @@ alter table attr_def add column ad_search_followup int; alter table attr_def alter column ad_search_followup set default 1; update attr_def set ad_search_followup=1; comment on column attr_def.ad_search_followup is '1 : search available from followup , 0 : search not available in followup' + + +create table jnt_document_option_contact +( +jdoc_id bigserial primary key, +jdoc_enable int not null, +document_type_id bigint references document_type (dt_id) on delete cascade on update cascade, +contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cascade on update cascade +); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); From 1b041e65de5d508c1af1619e11f316b94701d809 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 10 Oct 2020 19:34:30 +0200 Subject: [PATCH 50/65] Add new type of attribute : check --- include/class/card_attribut_mtable.class.php | 2 ++ include/class/fiche.class.php | 16 ++++++++++++++++ include/class/fiche_attr.class.php | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/class/card_attribut_mtable.class.php b/include/class/card_attribut_mtable.class.php index 2933dae01..7b468f41f 100644 --- a/include/class/card_attribut_mtable.class.php +++ b/include/class/card_attribut_mtable.class.php @@ -54,11 +54,13 @@ class Card_Attribut_MTable extends Manage_Table_SQL ["value"=>"select", "label"=>_("Choix")], ["value"=>"card", "label"=>_("Fiche")], ["value"=>"zone", "label"=>_("Zone de texte")], + ["value"=>"check", "label"=>_("Coche")], ["value"=>"poste", "label"=>_("Poste comptable")] )); $this->set_col_tips("ad_search_followup", 77); // to prevent a call to this function for each row $this->dossier_id=Dossier::id(); + $this->set_col_sort(1); } /** diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index a6a8e214a..98aee882c 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -29,6 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php'; require_once NOALYSS_INCLUDE.'/lib/iposte.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_account.class.php'; +require_once NOALYSS_INCLUDE."/lib/input_switch.class.php"; /*! \file * \brief define Class fiche, this class are using @@ -502,6 +503,11 @@ class Fiche $w->table = 1; $bulle = Icon_Action::infobulle(14); break; + case 'check': + $w=new InputSwitch("av_text".$r->ad_id); + $w->value=$r->av_text; + $w->value=(trim($w->value)=="")?1:$w->value; + break; case 'select': $w = new ISelect("av_text" . $attr->ad_id); $w->value = $this->cn->make_array($attr->ad_extra); @@ -641,6 +647,11 @@ class Fiche $w->style=' class="itextarea" style="margin:0px;width:100%"'; $w->value=$r->av_text; break; + case 'check': + $w=new InputSwitch("av_text".$r->ad_id); + $w->value=$r->av_text; + $w->value=(trim($w->value)=="")?1:$w->value; + break; case 'poste': $w=new IPoste("av_text".$r->ad_id); $w->set_attribute('ipopup', 'ipop_account'); @@ -711,6 +722,11 @@ class Fiche $value=$x->display(); $w->value=$value; break; + case 'check': + $w=new InputSwitch("av_text".$r->ad_id); + $w->value=$r->av_text; + $w->value=(trim($w->value)=="")?1:$w->value; + break; default: $w->value=$r->av_text; } diff --git a/include/class/fiche_attr.class.php b/include/class/fiche_attr.class.php index 7133a0a05..ee7184195 100644 --- a/include/class/fiche_attr.class.php +++ b/include/class/fiche_attr.class.php @@ -39,7 +39,7 @@ class Fiche_Attr extends Attr_def_SQL if (strlen(trim($this->ad_type))==0) throw new Exception('Le type ne peut pas être vide', 1); $this->ad_type=strtolower($this->ad_type); - if (in_array($this->ad_type, array('date', 'text', 'numeric', 'zone', 'poste', 'card', 'select'))==false) + if (in_array($this->ad_type, array('date', 'text', 'numeric', 'zone', 'poste', 'card', 'select','check'))==false) throw new Exception('Le type doit être text, numeric,poste, card, select ou date', 1); if (trim($this->ad_size)==''||isNumber($this->ad_size)==0||$this->ad_size>22) { From 30688bda9d5edda7a8da833ad97bef4573b6fce9 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 10 Oct 2020 19:35:10 +0200 Subject: [PATCH 51/65] Improve Input_Switch , do not echo but returns string --- include/lib/input_switch.class.php | 15 ++++++++------- include/template/param_jrn.php | 2 +- scenario/HtmlInput.test.php | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/lib/input_switch.class.php b/include/lib/input_switch.class.php index ba67d7f55..3d8345cfe 100644 --- a/include/lib/input_switch.class.php +++ b/include/lib/input_switch.class.php @@ -45,6 +45,7 @@ class InputSwitch extends HtmlInput function input($p_name=NULL, $p_value=NULL) { + $r=""; if ($p_name!=NULL) $this->value_container=$p_name; if ($p_value!==NULL) @@ -56,25 +57,25 @@ class InputSwitch extends HtmlInput throw new Exception(_("Valeur invalide"),1); } if ($this->readOnly == TRUE) { - $this->display(); - return; + return $this->display(); } - echo HtmlInput::hidden($this->value_container, $this->value); + $r.= HtmlInput::hidden($this->value_container, $this->value); $this->javascript=sprintf('toggle_onoff(\'%s\',\'%s\');%s;',$this->icon,$this->value_container,$this->javascript); if ($this->value=='1') { - echo Icon_Action::iconon($this->icon, $this->javascript); + $r.=Icon_Action::iconon($this->icon, $this->javascript); } else { - echo Icon_Action::iconoff($this->icon, $this->javascript); + $r.=Icon_Action::iconoff($this->icon, $this->javascript); } + return $r; } function display() { if ($this->value=='1') { - echo Icon_Action::iconon($this->icon, ""); + return Icon_Action::iconon($this->icon, ""); } else { - echo Icon_Action::iconoff($this->icon, ""); + return Icon_Action::iconoff($this->icon, ""); } } diff --git a/include/template/param_jrn.php b/include/template/param_jrn.php index 6c73529d9..1d0ce32bb 100644 --- a/include/template/param_jrn.php +++ b/include/template/param_jrn.php @@ -98,7 +98,7 @@ if ( $type == 'ACH' || $type == 'VEN'||$new): javascript="toggle_row_warning_enable('negative_amount','row_warning')"; - $negative->input(); + echo $negative->input(); ?> diff --git a/scenario/HtmlInput.test.php b/scenario/HtmlInput.test.php index 027f4eb73..363a8fdc3 100644 --- a/scenario/HtmlInput.test.php +++ b/scenario/HtmlInput.test.php @@ -61,25 +61,25 @@ $http=new HttpInput();
             
         $input_switch=new InputSwitch('input_switch_value',get("input_switch_value","string","0")?>);
    -    $input_switch->input();
    +    echo $input_switch->input();
         
    input_switch get("input_switch_value","string","0")); - $input_switch->input(); + echo $input_switch->input(); ?>

    ReadOnly

         $input_switch=new InputSwitch('input_switch_readonly',0);
         $input_switch->readOnly=TRUE;
    -    $input_switch->input();
    +    echo  $input_switch->input();
         
    input_switch readOnly=TRUE; - $input_switch->input(); + echo $input_switch->input(); ?>

    Submit

    
    From 8033b9f7ca7dd68a3aa6f4c0cb001d49f0e8a6a3 Mon Sep 17 00:00:00 2001
    From: Dany De Bontridder 
    Date: Sat, 10 Oct 2020 19:35:33 +0200
    Subject: [PATCH 52/65] Card can be disable if not used anymore
    
    ---
     html/fid_card.php                |  4 +++-
     html/js/card.js                  | 15 +++++++++++++--
     include/ajax/ajax_card.php       | 15 ++++++++++++++-
     include/template/card_result.php |  4 ++--
     sql/upgrade.sql                  |  5 +++++
     5 files changed, 37 insertions(+), 6 deletions(-)
    
    diff --git a/html/fid_card.php b/html/fid_card.php
    index 0c66dec21..d01a89b86 100644
    --- a/html/fid_card.php
    +++ b/html/fid_card.php
    @@ -118,13 +118,15 @@ else
             }
         }
     }
    +// filter only enable card
    +$filter_enable_card=" and f_id in (select f_id from fiche_detail where ad_value = '1' and ad_id=54) ";
     
     $sql_str="select distinct f_id 
              from fiche 
              join fiche_detail using (f_id) 
              where 
              ad_id in (9,1,23) 
    -         and ad_value ilike '%'||$1||'%' ".$filter_card.' limit '.$limit;
    +         and ad_value ilike '%'||$1||'%' ".$filter_enable_card.$filter_card.' limit '.$limit;
     
     
     $fid=$http->request("FID");
    diff --git a/html/js/card.js b/html/js/card.js
    index 253d213b5..3228d517d 100644
    --- a/html/js/card.js
    +++ b/html/js/card.js
    @@ -79,6 +79,8 @@ function search_card(obj)
             var price=obj.price;
             var tvaid=obj.tvaid;
             var jrn=obj.jrn;
    +        var inactive_card=0;
    +        if ( obj.inactive_card) {inactive_card=obj.inactive_card.value;}
             var amount_from_type=0;
             if ( obj.amount_from_type) {
                 amount_from_type=obj.amount_from_type;
    @@ -104,7 +106,8 @@ function search_card(obj)
                           'ctl':'search_card','op2':'fs','jrn':jrn,
                           'typecard':typecard,'query':string_to_search,'op':'card',
                           'accvis':accvis,
    -                      'amount_from_type':amount_from_type
    +                      'amount_from_type':amount_from_type,
    +                      'inactive_card':inactive_card
                                  });
     	if (  $('search_card') ) {
     	    removeDiv('search_card');
    @@ -184,6 +187,7 @@ function action_concerned_search_card(obj)
             var inp="";
             var ag_id=0;
             var search_in=-1;
    +        var inactive_card=0;
             
             if (obj.dossier) {
                 dossier = obj.dossier; /* From the button */
    @@ -208,6 +212,9 @@ function action_concerned_search_card(obj)
                 if (obj.elements['search_in']) {
                     search_in = obj.elements['search_in'].value;
                 }
    +            if ( obj.inactive_card) {
    +                inactive_card=obj.elements['inactive_card'].value;
    +            }
             }
             if (dossier == 0) {
                 throw "obj.dossier not found";
    @@ -223,7 +230,8 @@ function action_concerned_search_card(obj)
                 'ag_id' : ag_id,
                 'op':'card',
                 'accvis':0,
    -            'search_in':search_in
    +            'search_in':search_in,
    +            'inactive_card':inactive_card
             });
     
             waiting_box();
    @@ -336,6 +344,9 @@ function search_get_card(obj)
         if (obj.elements['page_card']) {
             queryString+="&page_card="+obj.elements["page_card"].value;
         }
    +    if ( obj.elements["inactive_card"]) {
    +         queryString+="&inactive_card="+obj.elements["inactive_card"].value;
    +    }
     
         queryString=encodeURI(queryString);
         $('asearch').innerHTML=loading();
    diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
    index b3103e471..cfc824a65 100644
    --- a/include/ajax/ajax_card.php
    +++ b/include/ajax/ajax_card.php
    @@ -423,6 +423,11 @@ case 'fs':
      
         // to navigate
         $page_card=$http->get("page_card","number",0);
    +    $inactive=$http->get("inactive_card","string",0);
    +    if ($inactive=="undefined" || $inactive == "") $inactive=0;
    +    $is=new InputSwitch("inactive_card",$inactive);
    +    $is->value=$inactive;
    +    $r.=_("Toutes les fiches").$is->input();
         
         // save previous info
         $hidden="";
    @@ -439,6 +444,7 @@ case 'fs':
         $r.="";
     
         $sql_array["query"]=$query;
    +    $sql_array["inactive_card"]=$inactive;
         /* what is the type of the ledger */
         $type="GL";
         if (isset($jrn) && $jrn > 1)
    @@ -465,8 +471,15 @@ case 'fs':
                  $html.=HtmlInput::button_close("search_card");
                  break;
         }
    +    /**
    +     * if inactive == 0 , then only active card
    +     */
    +    if ( $inactive == 0 ) {
    +        $sql.=" and f_id in (select f_id from fiche_detail where ad_id=54 and ad_value='1') ";
    +    }
    +    
          /* We limit the search to MAX_SEARCH_CARD records */
    -   $sql=$sql.' order by vw_name ';
    +    $sql=$sql.' order by vw_name ';
        $total_card=$cn->get_value("select count(*) from ($sql) as c");
         
         $record_start=$page_card*MAX_SEARCH_CARD;
    diff --git a/include/template/card_result.php b/include/template/card_result.php
    index 466e7d735..7c86f3938 100644
    --- a/include/template/card_result.php
    +++ b/include/template/card_result.php
    @@ -14,7 +14,7 @@
             echo '
    '; $url=$sql_array; $url["page_card"]=$page_card-1; - echo HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query'), $url); + echo HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query','inactive_card'), $url); echo HtmlInput::submit("previous","<"); echo '
    '; echo '
  • '; @@ -24,7 +24,7 @@ echo '
    '; $url=$sql_array; $url["page_card"]=$page_card+1; - echo HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query'), $url); + echo HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query','inactive_card'), $url); echo HtmlInput::submit("next",">"); echo '
    '; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 50e61a794..e3b85d573 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -16,3 +16,8 @@ contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cas ); ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); + +insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); +insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; +insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; +insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1; \ No newline at end of file From 67ce2beee64fffa412bd874a80279f2b1c7d5b73 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 10 Oct 2020 19:49:33 +0200 Subject: [PATCH 53/65] Search on active card for Contact Multiple --- include/ajax/ajax_add_concerned_card.php | 7 ++++ include/class/card_multiple.class.php | 45 +++++++++++++++++++----- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/include/ajax/ajax_add_concerned_card.php b/include/ajax/ajax_add_concerned_card.php index 6b0d61d15..1f9f97286 100644 --- a/include/ajax/ajax_add_concerned_card.php +++ b/include/ajax/ajax_add_concerned_card.php @@ -72,6 +72,12 @@ $r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton"); $r.=''; $r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card'); $r.=HtmlInput::request_to_hidden(array('ag_id')); +$inactive=$http->get("inactive_card","string",0); +if ($inactive=="undefined" || $inactive == "") $inactive=0; +$is=new InputSwitch("inactive_card",$inactive); +$is->value=$inactive; +$r.=_("Toutes les fiches").$is->input(); + $r.=''; @@ -79,6 +85,7 @@ $query=$http->get("query", "string",""); $sql_array['query']=$query; $sql_array['typecard']='all'; $sql_array['search_in']=$select->selected; +$sql_array['inactive_card']=$inactive; $fiche=new Card_Multiple($cn); /* Build the SQL and show result */ diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php index e03a185a0..b4094851b 100644 --- a/include/class/card_multiple.class.php +++ b/include/class/card_multiple.class.php @@ -31,41 +31,68 @@ class Card_Multiple $this->sql="select f_id,quick_code,vw_name,accounting,vw_first_name,vw_description from vw_fiche_attr "; } - + /** + * + * @param type $sql_array + * @return type + */ function build_sql($sql_array) { $cn=Dossier::connect(); + $filter=""; + if ( $sql_array["inactive_card"]==0) { + $filter=" and ".$this->filter_enable_card(); + } $query=sql_string($sql_array['query']); if ( $sql_array['search_in'] == "-1") { $string_sql=$this->sql." where - vw_name ilike '%$query%' - or quick_code ilike '%$query%' + (vw_name ilike '%$query%' + or quick_code ilike '%$query%') + ".$filter." order by vw_name limit ".MAX_CARD_SEARCH; } else { $string_sql=sprintf($this->sql." where f_id in (select f_id from fiche_detail where - ad_id = '%s' and ad_value ilike '%%%s%%') " - , sql_string($sql_array["search_in"]),$query); + ad_id = '%s' and ad_value ilike '%%%s%%') and %s" + , sql_string($sql_array["search_in"]),$query,$filter); } return $string_sql; } - + /** + * + * @param type $sql_array + * @return type + */ function count_sql($sql_array) { $cn=Dossier::connect(); $query=sql_string($sql_array['query']); + $filter=""; + if ( $sql_array["inactive_card"]==0) { + $filter="and ".$this->filter_enable_card(); + } $string_sql="select count(*) from vw_fiche_attr where - vw_name ilike '%$query%' - or quick_code ilike '%$query%'"; + ( vw_name ilike '%$query%' + or quick_code ilike '%$query%') + ".$filter; - return $cn->get_value($string_sql); ; + return $cn->get_value($string_sql); + } + /** + * + * @return string + */ + private function filter_enable_card() + { + $filter_enable_card=" f_id in (select f_id from fiche_detail where ad_value = '1' and ad_id=54) "; + return $filter_enable_card; } /** * From d3a05bfa18d4ece3ccf1ab220d32701b76af4cb5 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 10 Oct 2020 20:19:47 +0200 Subject: [PATCH 54/65] Tag Limit column size , replace input_switch by check_box --- include/class/action_document_type_mtable.class.php | 4 +--- include/class/follow_up.class.php | 4 ++-- include/template/action_document_type_mtable_input.php | 8 +++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php index d3cc70b14..03a7d2dbf 100644 --- a/include/class/action_document_type_mtable.class.php +++ b/include/class/action_document_type_mtable.class.php @@ -224,9 +224,7 @@ class Action_Document_Type_MTable extends Manage_Table_SQL $cn->exec_sql("insert into jnt_document_option_contact (jdoc_enable,document_type_id,contact_option_ref_id) values ($1,$2,$3)",[$this->other["contact_option".$e],$object_sql->dt_id,$option_id]); - tracedebug("insert-into-contact.log", $cn->sql); - tracedebug("insert-into-contact.log", $cn->array); - } + } } } diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index 11b5f3ca6..b04bc903e 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -616,7 +616,7 @@ class Follow_Up $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd'); $table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd'); $table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date desc', 'ra', 'rd'); - $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad'); + $table->add('Etiquette', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad'); $table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd'); $table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded'); $table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed'); @@ -666,7 +666,7 @@ class Follow_Up $r.=''.$table->get_header(0).''; $r.=''.$table->get_header(1).''; $r.=''.$table->get_header(2).''; - $r.=''.$table->get_header(3).''; + $r.=''.$table->get_header(3).''; $r.=''.$table->get_header(4).''; $r.=''.$table->get_header(5).''; $r.=''.$table->get_header(6).''; diff --git a/include/template/action_document_type_mtable_input.php b/include/template/action_document_type_mtable_input.php index 9328c4c80..784a4f069 100644 --- a/include/template/action_document_type_mtable_input.php +++ b/include/template/action_document_type_mtable_input.php @@ -25,6 +25,7 @@ if (!defined('ALLOWED')) * @file * @brief called from p_id already set, * @see action_document_type_mtable::input + * @see */ // SQL Object Document_Type $table=$this->get_table(); @@ -107,7 +108,12 @@ for ($i=0;$i<$nb_option;$i++) echo '
  • '; echo HtmlInput::hidden("cor_id[]", $aOption[$i]["cor_id"]); - $is=new InputSwitch("contact_option$i",$aOption[$i]["jdoc_enable"]); + $is=new ICheckBox("contact_option$i",1); + if ($aOption[$i]['jdoc_enable'] ==1 ) { + $is->set_check(1); + } else { + $is->set_check(0); + } echo $is->input(); echo "   "._($aOption[$i]['cor_label']); echo '
  • '; From 75190f41e1735cb71f0a22f8fc74aae9d0a4c2d0 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 10 Oct 2020 21:21:14 +0200 Subject: [PATCH 55/65] Contact option : export CSV --- html/export.php | 1 + include/action.common.inc.php | 3 + .../export/export_follow_up_contact_csv.php | 68 +++++++++++++++++++ include/template/detail-action.php | 10 ++- sql/upgrade.sql | 4 +- 5 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 include/export/export_follow_up_contact_csv.php diff --git a/html/export.php b/html/export.php index d32bc4975..9b5044c2c 100644 --- a/html/export.php +++ b/html/export.php @@ -50,6 +50,7 @@ if ( $action=='X' || $g_user->check_print($action)==0 ) $prfile=$cn->get_value("select me_file from menu_ref where me_code=$1",array($action)); if ( $prfile == "") { + print $action; die (_('Export impossible')); } require_once NOALYSS_INCLUDE."/export/$prfile"; diff --git a/include/action.common.inc.php b/include/action.common.inc.php index 33904ec76..257915c3e 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -209,9 +209,11 @@ if ($sub_action == 'detail') $act->ag_id = $ag_id; echo $act->get(); } + if ($g_user->can_write_action($ag_id) == true) { + echo '
    '; echo $supl_hidden; echo HtmlInput::hidden('ac', $http->request('ac')); @@ -221,6 +223,7 @@ if ($sub_action == 'detail') echo ''; echo HtmlInput::submit("save", "Sauve",' onclick="$(\'delete\').value=0"'); echo HtmlInput::submit("add_action_here", _("Ajoute un événement à celui-ci"),' onclick="$(\'delete\').value=0"'); + // if ($g_user->can_delete_action($ag_id)) { diff --git a/include/export/export_follow_up_contact_csv.php b/include/export/export_follow_up_contact_csv.php new file mode 100644 index 000000000..569f94f12 --- /dev/null +++ b/include/export/export_follow_up_contact_csv.php @@ -0,0 +1,68 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); +require_once NOALYSS_INCLUDE.'/class/follow_up.class.php'; +require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php'; + +$http=new HttpInput(); +$ag_id=$http->get("ag_id", "number"); + +if ( $g_user->can_read_action($ag_id) == false ) return; + + +/** + * @file + * @brief export a follow up in CSV + */ +$csv=new Noalyss_CSV("followup".$ag_id); +$csv->send_header(); + +$document=new Follow_Up($cn); +echo $document->export_csv(["tdoc"=>$ag_id]); + +$ret=$cn->exec_sql("select f_id,(select ad_value from fiche_detail where f_id=a.f_id and ad_id=25) as company, +(select ad_value from fiche_detail where f_id=a.f_id and ad_id=1) as name, +(select ad_value from fiche_detail where f_id=a.f_id and ad_id=32) as first_name, +(select ad_value from fiche_detail where f_id=a.f_id and ad_id=23) as quick_code, +cor.cor_label, +apo.ap_value +from action_person a +left join action_person_option apo ON (a.ap_id=apo.action_person_id) +left join contact_option_ref cor on (apo.contact_option_ref_id=cor.cor_id) +where ag_id=$1",[$ag_id]); +$aTitle= array ( + array("title"=>_("fiche_id"), "type"=>"string"), + array("title"=>_("société"), "type"=>"string"), + array("title"=>_("nom"), "type"=>"string"), + array("title"=>_("prénom"), "type"=>"string"), + array("title"=>_("qcode"), "type"=>"string"), + array("title"=>_("option"), "type"=>"string"), + array("title"=>_("valeur"), "type"=>"string")); +$cn->query_to_csv($ret,$aTitle); + +$ret=$cn->exec_sql('select t_tag,t_description from action_tags join tags using (t_id) where ag_id=$1',[$ag_id]); +$aTitle=array( + array('title'=>_('Etiquette'),"type"=>"string"), + array('title'=>_("Description"),"type"=>"string") +); +$cn->query_to_csv($ret,$aTitle); \ No newline at end of file diff --git a/include/template/detail-action.php b/include/template/detail-action.php index 515559014..fc5c20b28 100644 --- a/include/template/detail-action.php +++ b/include/template/detail-action.php @@ -80,7 +80,13 @@ $uniq=uniqid("tab",TRUE); ?> - + Dossier::id(), + "act"=>"CSV:FollowUpContactOption", + "ag_id"=>$ag_id]); + echo HtmlInput::anchor(_("Export CSV"), $csv); + ?> @@ -149,7 +155,7 @@ $uniq=uniqid("tab",TRUE); ag_id > 0 ): ?> - Dossier / tags + Dossier / Etiquette diff --git a/sql/upgrade.sql b/sql/upgrade.sql index e3b85d573..4d158ddaa 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -20,4 +20,6 @@ ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_optio insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; -insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1; \ No newline at end of file +insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1; +insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); +insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile; From 14a8d24b991b40f5bf179ba6dd415beef93cb051 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 10 Oct 2020 21:34:51 +0200 Subject: [PATCH 56/65] Search concerned card with company , name , ... and export contact option to CSV --- include/ajax/ajax_add_concerned_card.php | 2 +- include/class/card_multiple.class.php | 3 ++- include/template/card_multiple_result.php | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/ajax/ajax_add_concerned_card.php b/include/ajax/ajax_add_concerned_card.php index 1f9f97286..de16902d8 100644 --- a/include/ajax/ajax_add_concerned_card.php +++ b/include/ajax/ajax_add_concerned_card.php @@ -112,9 +112,9 @@ for ($i=0; $iinput(); $array[$i]['quick_code']=$a[$i]['quick_code']; $array[$i]['name']=h($a[$i]['vw_name']); - $array[$i]['accounting']=$a[$i]['accounting']; $array[$i]['first_name']=h($a[$i]['vw_first_name']); $array[$i]['description']=h($a[$i]['vw_description']); + $array[$i]['company']=h($a[$i]['company']); }//foreach // No accountancy history diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php index b4094851b..2fbd1a4d8 100644 --- a/include/class/card_multiple.class.php +++ b/include/class/card_multiple.class.php @@ -28,7 +28,8 @@ class Card_Multiple private $sql ; //!< SQL with the right column name function __construct() { - $this->sql="select f_id,quick_code,vw_name,accounting,vw_first_name,vw_description + $this->sql="select f_id,quick_code,vw_name,accounting,vw_first_name,vw_description, + (select ad_value from fiche_detail fd where fd.f_id=vw_fiche_attr.f_id and fd.ad_id=25) as company from vw_fiche_attr "; } /** diff --git a/include/template/card_multiple_result.php b/include/template/card_multiple_result.php index cef4de134..9afdb5699 100644 --- a/include/template/card_multiple_result.php +++ b/include/template/card_multiple_result.php @@ -13,6 +13,11 @@ $nb_array=count($array); ?> + + + + + @@ -22,11 +27,11 @@ $nb_array=count($array); -
    - + + From fb60db4018aebfbeb4413665b5445c8dc8aae4bb Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 10:24:31 +0200 Subject: [PATCH 57/65] Fix : by default new contact options were not added to document_type --- include/class/action_document_type_mtable.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php index 03a7d2dbf..f02f56d7b 100644 --- a/include/class/action_document_type_mtable.class.php +++ b/include/class/action_document_type_mtable.class.php @@ -168,6 +168,18 @@ class Action_Document_Type_MTable extends Manage_Table_SQL // Detail option contact $table=$this->get_table(); $cn=$table->cn; + // insert new contact options + $cn->exec_sql("insert into jnt_document_option_contact (jdoc_enable,document_type_id, + contact_option_ref_id) + select 0 , $1, cor_id + from contact_option_ref + where + cor_id not in (select cor_id from + jnt_document_option_contact a + where a.document_type_id=$1)",[$table->dt_id]); + + // Select all + $aOption=$cn->get_array("select cor_id,cor_label,cor_type,document_type_id ,coalesce(jdoc_enable,0) jdoc_enable from contact_option_ref cor From 0161cd0d6930dd06cd2494a7e6b534bcf2485664 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 10:26:47 +0200 Subject: [PATCH 58/65] Add : upgrade scrip added --- include/constant.php | 2 +- include/database/attr_def_sql.class.php | 68 +++++++++++++++++++++++++ include/sql/patch/upgrade145.sql | 32 ++++++++++++ sql/upgrade.sql | 25 --------- 4 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 include/database/attr_def_sql.class.php create mode 100644 include/sql/patch/upgrade145.sql diff --git a/include/constant.php b/include/constant.php index c6c0d23ca..b8d723d9c 100644 --- a/include/constant.php +++ b/include/constant.php @@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",145); +define ("DBVERSION",146); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",18); define ('NOTFOUND','--not found--'); diff --git a/include/database/attr_def_sql.class.php b/include/database/attr_def_sql.class.php new file mode 100644 index 000000000..450a1203a --- /dev/null +++ b/include/database/attr_def_sql.class.php @@ -0,0 +1,68 @@ +table="public.attr_def"; + $this->primary_key="ad_id"; + /* + * List of columns + */ + $this->name=array( + "id"=>"ad_id" + , "desc"=>"ad_text" + , "type"=>"ad_type" + , "size"=>"ad_size" + , "extra"=>"ad_extra" + , "search_followup"=>"ad_search_followup" + ); + /* + * Type of columns + */ + $this->type=array( + "ad_id"=>"numeric" + , "ad_text"=>"text" + , "ad_type"=>"text" + , "ad_size"=>"text" + , "ad_extra"=>"text" + , "ad_search_followup"=>"numeric" + ); + + + $this->default=array( + "ad_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} diff --git a/include/sql/patch/upgrade145.sql b/include/sql/patch/upgrade145.sql new file mode 100644 index 000000000..98b6fffef --- /dev/null +++ b/include/sql/patch/upgrade145.sql @@ -0,0 +1,32 @@ +begin; + +ALTER TABLE public.document_option ADD do_option varchar NULL; +COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail'; + +alter table attr_def add column ad_search_followup int; +alter table attr_def alter column ad_search_followup set default 1; +update attr_def set ad_search_followup=1; +comment on column attr_def.ad_search_followup is '1 : search available from followup , 0 : search not available in followup'; + + +create table jnt_document_option_contact +( +jdoc_id bigserial primary key, +jdoc_enable int not null, +document_type_id bigint references document_type (dt_id) on delete cascade on update cascade, +contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cascade on update cascade +); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); + +insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); +insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; +insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; +insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1 and f_id not in (select f_id from fiche_detail where ad_id=54); +insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); +insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile; + + + +insert into version (val,v_description) values (146,'Export CSV for Multiple card, contact option by document type'); +commit; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 4d158ddaa..e69de29bb 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,25 +0,0 @@ -ALTER TABLE public.document_option ADD do_option varchar NULL; -COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail'; - -alter table attr_def add column ad_search_followup int; -alter table attr_def alter column ad_search_followup set default 1; -update attr_def set ad_search_followup=1; -comment on column attr_def.ad_search_followup is '1 : search available from followup , 0 : search not available in followup' - - -create table jnt_document_option_contact -( -jdoc_id bigserial primary key, -jdoc_enable int not null, -document_type_id bigint references document_type (dt_id) on delete cascade on update cascade, -contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cascade on update cascade -); -ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); -ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); - -insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); -insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; -insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; -insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1; -insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); -insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile; From 13c76eec25b194228a2c6390c1c53c121253b18f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 14:39:26 +0200 Subject: [PATCH 59/65] fix upgrade145.sql , default value must be 1 for actif, sql wrong --- include/class/card_multiple.class.php | 2 +- include/constant.php | 1 + include/sql/patch/upgrade145.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php index 2fbd1a4d8..d70c23745 100644 --- a/include/class/card_multiple.class.php +++ b/include/class/card_multiple.class.php @@ -57,7 +57,7 @@ class Card_Multiple ".MAX_CARD_SEARCH; } else { $string_sql=sprintf($this->sql." where f_id in (select f_id from fiche_detail where - ad_id = '%s' and ad_value ilike '%%%s%%') and %s" + ad_id = '%s' and ad_value ilike '%%%s%%') %s" , sql_string($sql_array["search_in"]),$query,$filter); } return $string_sql; diff --git a/include/constant.php b/include/constant.php index b8d723d9c..7382a81e2 100644 --- a/include/constant.php +++ b/include/constant.php @@ -212,6 +212,7 @@ define( 'ATTR_DEF_ACCOUNT_ND_TVA',50); define('ATTR_DEF_ACCOUNT_ND_TVA_ND',51); define ('ATTR_DEF_ACCOUNT_ND_PERSO',52); define ('ATTR_DEF_ACCOUNT_ND',53); +define ('ATTR_DEF_ACTIF',54); define ("FICHE_TYPE_CLIENT",9); define ("FICHE_TYPE_VENTE",1); diff --git a/include/sql/patch/upgrade145.sql b/include/sql/patch/upgrade145.sql index 98b6fffef..cd5a13cfb 100644 --- a/include/sql/patch/upgrade145.sql +++ b/include/sql/patch/upgrade145.sql @@ -23,6 +23,7 @@ insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check',' insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1 and f_id not in (select f_id from fiche_detail where ad_id=54); +update fiche_detail set ad_value='1' where ad_id=54; insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile; From 464567ec31bb116069de6feae70499ae24a344cd Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 17:35:55 +0200 Subject: [PATCH 60/65] Fix FollowUp : price Purchase or Sale --- include/class/follow_up_detail.class.php | 11 +++-------- include/template/follow_up_detail_display.php | 9 +++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/class/follow_up_detail.class.php b/include/class/follow_up_detail.class.php index 0967d99ea..2cdd338cb 100644 --- a/include/class/follow_up_detail.class.php +++ b/include/class/follow_up_detail.class.php @@ -236,16 +236,11 @@ class Follow_Up_Detail public static function display(Follow_Up $p_follow_up,$p_view) { + $option=$p_follow_up->db->get_value("select do_option from document_option " + . " where document_type_id=$1 and do_code='detail_operation'",[$p_follow_up->dt_id]); + require NOALYSS_TEMPLATE."/follow_up_detail_display.php"; } - /*!\brief - *\param - *\return - *\note - *\see - */ - static function test_me() -{} } diff --git a/include/template/follow_up_detail_display.php b/include/template/follow_up_detail_display.php index a86a2e844..0b3946f02 100644 --- a/include/template/follow_up_detail_display.php +++ b/include/template/follow_up_detail_display.php @@ -88,8 +88,13 @@ $menu=new Default_Menu(); $icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name); // name of the field to update with the name of the card $icard->set_attribute('label', 'e_march' . $i . '_label'); - // name of the field with the price - $icard->set_attribute('price', 'e_march' . $i . '_price'); + // name of the field with the price autocomplete + if ( $option == 'ACH'){ + $icard->set_attribute('purchase', 'e_march' . $i . '_price'); + } else { + $icard->set_attribute('price','e_march'.$i.'_price'); + } + // name of the field with the TVA_ID $icard->set_attribute('tvaid', 'e_march' . $i . '_tva_id'); $icard->amount_from_type=$option_detail; From 30ff1b125c8b84406dd0026918729bde521544ce Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 17:36:42 +0200 Subject: [PATCH 61/65] protect --- html/fid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/fid.php b/html/fid.php index 814a28376..2b6c38964 100644 --- a/html/fid.php +++ b/html/fid.php @@ -115,7 +115,7 @@ if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1) from vw_fiche_attr where quick_code=upper($1)". $filter_card; - $array=$cn->get_array($sql, array($_REQUEST['FID'])); + $array=$cn->get_array($sql, array($hi->request('FID'))); if ( empty($array)) { From 5ee686eae65331401a2c334c1f1cdd077bd138f9 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 17:58:24 +0200 Subject: [PATCH 62/65] Follow Up : multiple card , search by category of card --- html/js/card.js | 9 +++++++-- include/ajax/ajax_add_concerned_card.php | 15 +++++++++++++-- include/class/card_multiple.class.php | 18 ++++++++++++++---- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/html/js/card.js b/html/js/card.js index 3228d517d..3e9c112fd 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -188,6 +188,7 @@ function action_concerned_search_card(obj) var ag_id=0; var search_in=-1; var inactive_card=0; + var search_cat=-1; if (obj.dossier) { dossier = obj.dossier; /* From the button */ @@ -212,9 +213,12 @@ function action_concerned_search_card(obj) if (obj.elements['search_in']) { search_in = obj.elements['search_in'].value; } - if ( obj.inactive_card) { + if ( obj.elements['inactive_card']) { inactive_card=obj.elements['inactive_card'].value; } + if ( obj.elements['search_cat']) { + search_cat=obj.elements['search_cat'].value; + } } if (dossier == 0) { throw "obj.dossier not found"; @@ -231,7 +235,8 @@ function action_concerned_search_card(obj) 'op':'card', 'accvis':0, 'search_in':search_in, - 'inactive_card':inactive_card + 'inactive_card':inactive_card, + 'search_cat':search_cat }); waiting_box(); diff --git a/include/ajax/ajax_add_concerned_card.php b/include/ajax/ajax_add_concerned_card.php index de16902d8..9187a7045 100644 --- a/include/ajax/ajax_add_concerned_card.php +++ b/include/ajax/ajax_add_concerned_card.php @@ -63,21 +63,31 @@ $q->value=(isset($query))?$query:''; $r.=''; $r.=_('Fiche contenant').Icon_Action::infobulle(19); $r.=$q->input(); + // where to search $select=new ISelect("search_in"); $select->value=$cn->make_array("select ad_id, ad_text from attr_def where ad_search_followup = 1 order by 2 ",1); $select->selected=$http->get("search_in","string",""); $r.=_("limité aux champs ").$select->input(); -$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton"); + $r.=''; $r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card'); $r.=HtmlInput::request_to_hidden(array('ag_id')); + +// Search by category +$sel_Category=new ISelect("search_cat"); +$sel_Category->value=$cn->make_array("select fd_id,fd_label from fiche_def order by 2",1); +$sel_Category->set_value($http->request("search_cat","string","-1")); +$r.=_("Catégorie")." ".$sel_Category->input(); + +// search also inactive card $inactive=$http->get("inactive_card","string",0); if ($inactive=="undefined" || $inactive == "") $inactive=0; $is=new InputSwitch("inactive_card",$inactive); $is->value=$inactive; -$r.=_("Toutes les fiches").$is->input(); +$r.=_("Fiches inactives").$is->input(); +$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton"); $r.=''; @@ -86,6 +96,7 @@ $sql_array['query']=$query; $sql_array['typecard']='all'; $sql_array['search_in']=$select->selected; $sql_array['inactive_card']=$inactive; +$sql_array['search_cat']=$sel_Category->selected; $fiche=new Card_Multiple($cn); /* Build the SQL and show result */ diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php index d70c23745..4f59e8bfc 100644 --- a/include/class/card_multiple.class.php +++ b/include/class/card_multiple.class.php @@ -44,6 +44,11 @@ class Card_Multiple if ( $sql_array["inactive_card"]==0) { $filter=" and ".$this->filter_enable_card(); } + // By Cat of card + $sql_cat=""; + if ( $sql_array['search_cat']!=-1) { + $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']); + } $query=sql_string($sql_array['query']); if ( $sql_array['search_in'] == "-1") { @@ -51,14 +56,14 @@ class Card_Multiple where (vw_name ilike '%$query%' or quick_code ilike '%$query%') - ".$filter." + ".$filter.$sql_cat." order by vw_name limit ".MAX_CARD_SEARCH; } else { $string_sql=sprintf($this->sql." where f_id in (select f_id from fiche_detail where - ad_id = '%s' and ad_value ilike '%%%s%%') %s" - , sql_string($sql_array["search_in"]),$query,$filter); + ad_id = '%s' and ad_value ilike '%%%s%%') %s %s" + , sql_string($sql_array["search_in"]),$query,$filter,$sql_cat); } return $string_sql; } @@ -75,13 +80,18 @@ class Card_Multiple if ( $sql_array["inactive_card"]==0) { $filter="and ".$this->filter_enable_card(); } + // By Cat of card + $sql_cat=""; + if ( $sql_array['search_cat']!=-1) { + $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']); + } $string_sql="select count(*) from vw_fiche_attr where ( vw_name ilike '%$query%' or quick_code ilike '%$query%') - ".$filter; + ".$filter.$sql_cat; return $cn->get_value($string_sql); From c1b866fa81c0adb93b462662644abaa8a5884ade Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 17:59:48 +0200 Subject: [PATCH 63/65] Search card :typo --- include/ajax/ajax_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index cfc824a65..6af2b5be6 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -427,7 +427,7 @@ case 'fs': if ($inactive=="undefined" || $inactive == "") $inactive=0; $is=new InputSwitch("inactive_card",$inactive); $is->value=$inactive; - $r.=_("Toutes les fiches").$is->input(); + $r.=_("fiches inactives").$is->input(); // save previous info $hidden=""; From 650e55364e44aaacf42e98bfe9e5e9a40890f996 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 18:10:40 +0200 Subject: [PATCH 64/65] Follow up search card, add a button to select all , cosmetic add qcode in dialog box for contact option --- include/class/card_multiple.class.php | 5 +++++ include/template/card_multiple_display_option.php | 3 +++ include/template/card_multiple_result.php | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php index 4f59e8bfc..60ed305b0 100644 --- a/include/class/card_multiple.class.php +++ b/include/class/card_multiple.class.php @@ -127,6 +127,11 @@ class Card_Multiple if ( ! $g_user->can_read_action($ag_id)) { throw new Exception (_("CMCDO01"."Security")); } + // Retrieve Name, first Name and QCODE + $aIdentity=$cn->get_row("select (select ad_value from fiche_detail where f_id=$1 and ad_id=1) as name , + (select ad_value from fiche_detail where f_id=$1 and ad_id=32) as first_name , + (select ad_value from fiche_detail where f_id=$1 and ad_id=23) as qcode ",[$fiche_id]); + // insert new , synchronized $cn->exec_sql("insert into action_person_option (ap_value,contact_option_ref_id ,action_person_id ) select null,cor_id,$1 diff --git a/include/template/card_multiple_display_option.php b/include/template/card_multiple_display_option.php index 309aa3754..9e37e481a 100644 --- a/include/template/card_multiple_display_option.php +++ b/include/template/card_multiple_display_option.php @@ -35,6 +35,9 @@ if (!defined('ALLOWED')) * @see Card_Multiple */ ?> +

    + +

    diff --git a/include/template/card_multiple_result.php b/include/template/card_multiple_result.php index 9afdb5699..8c16fc32e 100644 --- a/include/template/card_multiple_result.php +++ b/include/template/card_multiple_result.php @@ -13,7 +13,7 @@ $nb_array=count($array); ?> - + From dd5b8c2e069a67921192e7444705dfe477f1ce8f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Oct 2020 18:21:51 +0200 Subject: [PATCH 65/65] Bug : from VEN , cannot get the price --- include/ajax/ajax_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 6af2b5be6..7b065898b 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -509,7 +509,7 @@ case 'fs': $price,$amount); } if ( $type=="VEN" ){ - $amount=(isNumber($aFound[$i]['vw_buy']) == 1 )?$aFound[$i]['vw_sell']:0; + $amount=(isNumber($aFound[$i]['vw_sell']) == 1 )?$aFound[$i]['vw_sell']:0; $array[$i]['javascript'].=sprintf("set_value('%s','%s');", $price,$amount); }