noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ajax_misc.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23/**
24 * \file
25 * \brief this file respond to an ajax request
26 * The parameters are
27 * - gDossier
28 * - $op operation the file has to execute
29 * Part 1
30 * dsp_tva fill a ipopup with a choice of possible VAT
31 * - if code is set then fill the field code
32 * - if compute is set then add event to call clean_tva and compute_ledger
33 @see Acc_Ledger_Sale::input
34 * Part 2
35 * dl : display form to modify, add and delete lettering for a given operation
36 *
37 */
38if ( ! defined('ALLOWED')) define ('ALLOWED',1);
39require_once '../include/constant.php';
40
41require_once NOALYSS_INCLUDE."/lib/ac_common.php";
42
43global $http;
44$http=new HttpInput();
45try {
46 $op= $http->request("op");
47 if ($op =='check_vatnumber') session_write_close();
48 if ($op =='search_peppol') session_write_close();
49
50} catch (\Exception $e) {
51 exit();
52}
53
54/* we ask a dg box for disconnecting */
55if ($http->request('op',"string","") == 'disconnect') {
56 ajax_disconnected("reconnect_bx");
57 return ;
58}
59
60/**
61 * if not connected, session is expired then exit with a message NOCONX
62 */
63if ( ! isset($_SESSION[SESSION_KEY."g_user"])) {
64 echo "NOCONX";
65 die();
66}
67
68mb_internal_encoding("UTF-8");
69
70// If not connected to a folder
71if ( ! isset($_REQUEST['gDossier'])) {
72 $gDossier=0;
73}
74
75
76
77extract($_REQUEST, EXTR_SKIP );
78
80//
81// If database id == 0 then we are not connected to a folder
82// but to the administration
83//
84if ($gDossier<>0) {
85 $cn =Dossier::connect();
87 $g_user = new Noalyss_user($cn);
88 $g_user->check(true);
89 if ( $g_user->check_dossier($gDossier, true) == 'X' ) {
90 die(_('Non autorisé'));
91 }
92}
93else
94{
95 // connect to repository
96 $cn=new Database();
97 $g_user = new Noalyss_user($cn);
98 $g_user->check(true);
99}
100/**
101 * check if 2FA is completed
102 */
103if ( ! $g_user->is_double_identified()) {
104 exit();
105}
106IDate::set_firstDate($g_user->get_first_week_day());
107ITva_Popup::set_vat_code($g_user->get_vat_code_preference());
108
109// For progress bar, for saving time , we check and answer directly
110if ($op == "progressBar") {
111 $task_id=$http->request("task_id");
112 $task=new Progress_Bar($task_id);
113 $task->answer();
114 return;
115}
116
117//-------------------------------------------------------------------------------------------
118// check password
119//-------------------------------------------------------------------------------------------
120if ($op=='password_chk') {
121 $cnt = $http->request("pass");
123 if (count($result) == 0) {
124 echo json_response(["password" => "ok", "msg" => 0]);
125 } else {
126 $str="";
127 foreach ($result as $item) {$str.=sprintf("<li>%s</li>",$item);}
128 echo json_response(["password" => "nok", "msg" => '<ol>'.$str.'</ol>']);
129
130 }
131 return;
132}
133$html = var_export($_REQUEST, true);
135if ( LOGINPUT)
136 {
137 $file_loginput=fopen($_ENV['TMP'].'/scenario-ajax-'.$_SERVER['REQUEST_TIME'].'.php','a+');
138 fwrite ($file_loginput,"<?php \n");
139 fwrite ($file_loginput,'//@description:'.$op."\n");
140 fwrite($file_loginput, '$_GET='.var_export($_GET,true));
141 fwrite($file_loginput,";\n");
142 fwrite($file_loginput, '$_POST='.var_export($_POST,true));
143 fwrite($file_loginput,";\n");
144 fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
145 fwrite($file_loginput,"\n");
146 fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
147 fwrite($file_loginput,"\n");
148 fwrite($file_loginput,' $_REQUEST=array_merge($_GET,$_POST);');
149 fwrite($file_loginput,"\n");
150 fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
151 fclose($file_loginput);
152 }
153
154/**
155 * for widget we call immediately a file outside the ajax folder
156 */
157if ($op == 'widget') {
158 session_write_close();
159 require_once NOALYSS_INCLUDE.'/widget/ajax.php';
160 return;
161}
162
163$path = array(
164 // search accounting , detail ...
165 "account"=>"ajax_account",
166 // display card detail :possible to update or add
167 "card"=>"ajax_card",
168 "ledger"=>"ajax_ledger",
169 // Manage ledger access
170 "ledger_access"=>"ajax_user_security",
171 // Manage user profile
172 "profile"=>"ajax_user_security",
173 // enable or not the security on ledger
174 "user_sec_ledger"=>"ajax_user_security",
175 // enable or not the security on action
176 "user_sec_action"=>"ajax_user_security",
177 // Update in once all the ledgers
178 "ledger_access_all"=>"ajax_user_security",
179 // From the page C0SEC,set the actions
180 "action_access"=>"ajax_user_security",
181 // From the page C0SEC,set all the actions
182 "action_access_all"=>"ajax_user_security",
183 "todo_list"=>"ajax_todo_list",
184 // Writing operation History for a card or an accounting
185 "history"=>"ajax_history",
186 "mod_doc"=>"ajax_mod_document",
187 // Periode menu: PERIODE
188 'periode'=>"ajax_periode",
189 "mod_predf"=>"ajax_mod_predf_op",
190 "save_predf"=>"ajax_save_predf_op",
191 "search_action"=>"ajax_search_action",
192 "display_profile"=>"ajax_get_profile",
193 "det_menu"=>"ajax_get_menu_detail",
194 "add_menu"=>"ajax_add_menu",
195 "display_submenu"=>"ajax_display_submenu",
196 "remove_submenu"=>"ajax_remove_submenu",
197 "cardsearch"=>"ajax_boxcard_search",
198 "saldo"=>"ajax_bank_saldo",
199 "upd_receipt"=>"ajax_get_receipt",
200 "up_pay_method"=>"ajax_update_payment",
201 "openancsearch"=>"ajax_anc_search",
202 "resultancsearch"=>"ajax_anc_search",
203 "autoanc"=>"ajax_auto_anc_card",
204 "create_menu"=>"ajax_create_menu",
205 "modify_menu"=>"ajax_mod_menu",
206 "mod_stock_repo"=>"ajax_mod_stock_repo",
207 "view_mod_stock"=>"ajax_view_mod_stock",
208 "fddetail"=>"ajax_fiche_def_detail",
209 "vw_action"=>"ajax_view_action",
210 "minrow"=>"ajax_min_row",
211 "navigator"=>"ajax_navigator",
212 "preference"=>"ajax_preference",
213 "bookmark"=>"ajax_bookmark",
214 // Tag
215 "tag_detail"=>"ajax_tag_detail",
216 "tag_save"=>"ajax_tag_save",
217 "tag_list"=>"ajax_tag_list",
218 "tag_add"=>"ajax_tag_add_action",
219 "tag_remove"=>"ajax_tag_remove_action",
220 "tag_choose"=>"ajax_tag_choose",
221 "tag_activate"=>"ajax_tag_save",
222 // search
223 "search_display_tag"=>"ajax_search_display_tag",
224 "search_add_tag"=>"ajax_search_add_tag",
225 "search_clear_tag"=>"ajax_search_clear_tag",
226 "calendar_zoom"=>"ajax_calendar_zoom",
227 "ledger_show"=>"ajax_ledger_show",
228 //Show the available distribution keys for analytic
229 "anc_key_choice"=>"ajax_anc_key_choice" ,
230 //Clean the detail for analytic
231 "anc_key_clean"=>"ajax_anc_key_clean" ,
232 // Show the activities computed with the selected distribution key
233 "anc_key_compute"=>"ajax_anc_key_compute" ,
234 //From admin, revoke the access to a folder from an user
235 "folder_remove"=>"ajax_admin",
236 //From admin, display a list of folder to which the user has no access
237 "folder_display"=>"ajax_admin",
238 // From admin, grant the access to a folder to an
239 // user
240 "folder_add"=>"ajax_admin",
241 // From admin, display info and propose to drop the folder
242 "folder_drop"=>"ajax_admin",
243 // From admin, display the information of a folder you can
244 // modify
245 "folder_modify"=>"ajax_admin",
246 // From admin, display info and propose to drop the template
247 "modele_drop"=>"ajax_admin",
248 // From admin, display the information of a template you can modify
249 "modele_modify"=>"ajax_admin",
250 // From admin , upgrade Noalyss
251 "upgradeCore"=>"ajax_admin",
252 // From admin , upgrade or install plugin
253 "upgradePlugin"=>"ajax_admin",
254 // From admin , install a template
255 "installTemplate"=>"ajax_admin",
256 // From dashboard, display detail about last operation
257 "action_show"=>"ajax_gestion",
258 // From dashboard, display form for a new event
259 "action_add"=>"ajax_gestion",
260 // Save a event given in the short form
261 "action_save"=>"ajax_gestion",
262 /* display the lettering , callebd from acc_ledger : dsp_letter*/
263 "dl"=>"ajax_display_letter",
264 // Add , delete update anc accounting
265 "anc_accounting"=>"ajax_anc_accounting",
266 // Update name and description
267 "anc_updatedescription"=>"ajax_anc_plan",
268 // Update, insert or delete accounting frmo C0PCMN
269 "accounting"=>"ajax_accounting",
270 // Show detail of an ANC operation
271 "anc_detail_op"=>"ajax_anc_detail_operation",
272 // show history of an analytic account
273 "history_anc_account"=>"ajax_history_anc_account",
274 // Display the list of filter saved
275 "display_search_filter"=>"ajax_search_filter",
276 // Save search filter
277 "save_filter"=>"ajax_search_filter",
278 // Load a search filter
279 "load_filter"=>"ajax_search_filter",
280 // display a list of filter (alias saved search)
281 "display_list_filter"=>"ajax_search_filter",
282 // display tag for filter
283 'display_filter_tag'=>'ajax_search_filter',
284 // search operation to reconcile
285 'search_op'=>'ajax_search_operation',
286 // delete operation
287 'delete_search_operation'=>'ajax_search_filter',
288 // template category of card
289 'template_cat_card'=>'ajax_template_cat_card',
290 // Attribute for category of card
291 'template_cat_category'=>'ajax_template_cat_category',
292 // From FollowUp , update a comment on a file
293 'update_comment_followUp'=>'ajax_follow_up',
294 // Update a follow up's comment
295 'followup_comment_oneedit'=>'ajax_follow_up',
296 // TVA param
297 "tva_parameter"=>"ajax_tva_parameter",
298 // Currency , add / remove / update currency
299 "CurrencyManage"=>"ajax_currency",
300 // Currency , delete a rate
301 "CurrencyRateDelete"=>"ajax_currency",
302 // payment_method
303 "payment_method"=>"ajax_payment_method",
304 // Display all cards using an accounting
305 "display_all_card"=>"ajax_display_all_card",
306 // update list of predefined operation if ledger changes
307 "up_predef"=>"ajax_update_predef",
308 // cfgaction type of document
309 "cfgaction"=>'ajax_cfgaction',
310 // list options for multiple contact
311 "contact_option_list"=>'ajax_contact_option_list',
312 // Add group of tags
313 'tag_group'=>'ajax_tag_group',
314 // set the group for a tag
315 'tag_set_group'=>"ajax_tag_set_group",
316 // Document_state
317 "document_state"=>"ajax_document_state",
318 // Operations tag add
319 'operation_tag_add'=>"ajax_operation_tag",
320 // Operations tag remove
321 'operation_tag_remove'=>"ajax_operation_tag",
322 // Operations tag select
323 'operation_tag_select'=>"ajax_operation_tag",
324 // add or update forecast_item
325 "forecast_item"=>"ajax_forecast_item",
326 // add or update forecast_category
327 "forecast_category"=>"ajax_forecast_category",
328 // manage forecast
329 "forecast"=>"ajax_forecast",
330 // manage company
331 "company"=>"ajax_company",
332 // report definition
333 "report_definition"=>"ajax_report_definition",
334 // search all card , analytic or accounting
335 "search_account_card"=>"ajax_search_account_card",
336 // Mobile device menu from mobile_device_mtable
337 "mobile_device_menu"=>"ajax_mobile_device_menu",
338 // other_tax
339 "other_tax"=>"ajax_other_tax",
340 //visibility quantity
341 "update_visibility_quantity"=>"ajax_update_visibility_quantity",
342 // detail customer , supplier operation
343 "event_display_detail"=>"ajax_event_display_detail",
344 // update periode in opening operation
345 "operation_exercice+update_periode"=>"ajax_operation_exercice",
346 // modify row in exercice (opening/closing) operation
347 "operation_exercice+modify_row"=>"ajax_operation_exercice",
348 // save row in exercice (opening/closing) operation
349 "operation_exercice+save_row"=>"ajax_operation_exercice",
350 // compute the balance after saving row in exercice (opening/closing) operation
351 "operation_exercice+display_total"=>"ajax_operation_exercice",
352 // delete row in exercice (opening/closing) operation
353 "operation_exercice+delete_row"=>"ajax_operation_exercice",
354 // date in exercice (opening/closing) operation
355 "operation_exercice+date"=>"ajax_operation_exercice",
356 // text in exercice (opening/closing) operation
357 "operation_exercice+text"=>"ajax_operation_exercice",
358 // transfer operation to accountancy
359 'operation_exercice+transfer'=>"ajax_operation_exercice",
360 // view list of followup for a card
361 "view_followup_card"=>"ajax_follow_up",
362 //list filter for followup
363 'list_filter_followup'=>"ajax_follow_up",
364 //delete a filter for followup
365 'delete_filter_followup'=>"ajax_follow_up",
366 // Check VAT NUMBER with VIES European VAT
367 "check_vatnumber"=>"ajax_check_vatnumber",
368 // Tax Detail
369 "tax_detail"=>"ajax_tax_detail"
370 // card category definition : from CCARD
371 ,"category_card_definition"=>"ajax_category_card_definition"
372 // activate plugin for a profile
373 ,'activate_plugin'=>'ajax_activate_plugin'
374 // set the operation paid or unpaid
375 , 'payment_status'=>'ajax_payment_status'
376 // email setting
377 , 'email_setting'=>'ajax_email_setting'
378 // check iban number
379 , 'check_ibannumber'=>'ajax_check_ibannumber'
380 // related to peppol : search
381 ,'search_peppol'=>'ajax_search_peppol'
382 // find and select a VATEX code : VAT Exemption code mandatory for PEPPOL
383 ,'search_vatex'=>'ajax_search_vatex'
384) ;
385
386if (array_key_exists($op, $path)) {
387 require NOALYSS_INCLUDE.'/ajax/'.$path[$op].".php";
388 return;
389}
390switch ($op)
391{
392 /*
393 * Get the currency rate
394 */
395 case "CurrencyRate":
396 $a_answer=array();
397 $a_answer['status']="NOK";
398 $http=new HttpInput();
399 try
400 {
401 $code=$http->get("p_code");
402 if ( $code==-1) {
403 $a_answer['content']=1;
404 }else {
405 $a_answer['content']=$cn->get_value("select ch_value from v_currency_last_value where currency_id=$1",
406 [$code]);
407 }
408 $a_answer['status']="OK";
409 }
410 catch (Exception $ex)
411 {
412 $a_answer['content']=$ex->getMessage();
413 }
414 $jsson=json_encode($a_answer, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
415 header('Content-Type: application/json;charset=utf-8');
416 echo $jsson;
417 return;
418
419
420 break;
421 /*
422 * Get the currency code
423 */
424 case "CurrencyCode":
425 $a_answer=array();
426 $a_answer['status']="NOK";
427 $http=new HttpInput();
428 try
429 {
430 $code=$http->get("p_code");
431 $a_answer['content']=$cn->get_value("select cr_code_iso||' ('||cr_name||')' from v_currency_last_value where currency_id=$1",
432 [$code]);
433 $a_answer['status']="OK";
434 }
435 catch (Exception $ex)
436 {
437 $a_answer['content']=$ex->getMessage();
438 }
439 $jsson=json_encode($a_answer, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
440 header('Content-Type: application/json;charset=utf-8');
441 echo $jsson;
442 return;
443
444
445 break;
446 case "periode_change":
447
448 $field=$http->get("field");
449 $type=$http->get("type");
450 $exercice=$http->get("exercice","number");
451 $last=$http->get("last","string",0);
452
453 // if last == 1 then show first and last periode of the
454 // exercice
456 $periode_end=0;
457 $t_periode=new Periode($cn);
458 if ( $last==1) {
459 list($per_max,$per_min)=$t_periode->get_limit($exercice);
460 $periode_start=$per_max->p_id;
461 $periode_end=$per_min->p_id;
462 }
463
464 $iperiod = new IPeriod($field);
465 $iperiod->id=$field;
466 $iperiod->user = $g_user;
467 $iperiod->cn = $cn;
468 $iperiod->filter_year = true;
469 $iperiod->exercice=$exercice;
470 // For France , propose the first periode
471 if ( $g_parameter->MY_REPORT=='N') {
472 $periode_start=$t_periode->get_first_periode();
473 $iperiod->filter_year = false;
474 }
475 if ( $type=="from")
476 {
477 $iperiod->show_end_date=FALSE;
478 $iperiod->value=$periode_start;
479 } elseif ($type=="to"){
480 $iperiod->show_start_date=FALSE;
481 $iperiod->value=$periode_end;
482
483 } else {
484 throw new Exception(_("Invalide type"));
485 }
486
487 $iperiod->type = ALL;
488 echo $iperiod->input();
489
490 return;
491
492 break;
493 case "pref_exercice":
494 $iperiod = new IPeriod("period");
495 $iperiod->id="setting_period";
496 $iperiod->user = $g_user;
497 $iperiod->cn = $cn;
498 $iperiod->filter_year = true;
499 $iperiod->exercice=$http->get("exercice");
500
501 $iperiod->type = ALL;
502 echo $iperiod->input();
503
504 return;
505 break;
506 case "remove_anc":
507 if ($g_user->check_module('ANCODS') == 0)
508 exit();
509 $oa_group=$http->get("oa","number");
510 $cn->exec_sql("delete from operation_analytique where oa_group=$1", array($oa_group));
511 break;
512 case "rm_stock":
513 if ($g_user->check_module('STOCK') == 0)
514 exit();
515 require_once NOALYSS_INCLUDE.'/constant.security.php';
516 $cn->exec_sql('delete from stock_goods where sg_id=$1', array($s_id));
517 $html = escape_xml($s_id);
518 header('Content-type: text/xml; charset=UTF-8');
519 printf('{"d_id":"%s"}', $s_id);
520 exit();
521 break;
522 //--------------------------------------------------
523 // get the last date of a ledger
524 case 'lastdate':
525 require_once NOALYSS_INCLUDE.'/class/acc_ledger_fin.class.php';
526 $p_jrn=$http->get('p_jrn','number');
528 $html = $ledger->get_last_date();
530 header('Content-type: text/xml; charset=UTF-8');
531 echo <<<EOF
532<?xml version="1.0" encoding="UTF-8"?>
533<data>
534<code>e_date</code>
536</data>
537EOF;
538
539 break;
540 case 'bkname':
541 require_once NOALYSS_INCLUDE.'/class/acc_ledger_fin.class.php';
542 $p_jrn=$http->get('p_jrn','number');
544 $html = $ledger->get_bank_name();
546 header('Content-type: text/xml; charset=UTF-8');
547 echo <<<EOF
548<?xml version="1.0" encoding="UTF-8"?>
549<data>
550<code>bkname</code>
552</data>
553EOF;
554 break;
555 // display new calendar
556 case 'cal':
557 require_once NOALYSS_INCLUDE.'/class/calendar.class.php';
558 /* others report */
559 $cal = new Calendar();
560 $per=$http->get("per","number");
561 $cal->set_periode($per);
562 $notitle=$http->get("notitle", "string",0);
563 $html = "";
564 $html = $cal->display($http->get('t'),$notitle);
566 header('Content-type: text/xml; charset=UTF-8');
567 echo <<<EOF
568<?xml version="1.0" encoding="UTF-8"?>
569<data>
570<code>$html</code>
571</data>
572EOF;
573 break;
574
575/**************************************************************************
576 * show dialog box to let the choice of a VAT to use
577 *************************************************************************/
578 case 'dsp_tva':
580 // Filter the VAT
581 $filter=$http->get("filter","string","none");
582 if ( $filter == 'sale') {
583 $Res = $cn->exec_sql("select *
584 from v_tva_rate
585 where
586 tva_sale <> '#'
587 order by tva_id asc");
588
589 } elseif ($filter == "purchase") {
590
591 $Res = $cn->exec_sql("select *
592 from
593 v_tva_rate
594 where
595 tva_purchase <> '#'
596 order by tva_id asc");
597 }else {
598
599 $Res = $cn->exec_sql("select * from v_tva_rate
600 where
601 tva_purchase <> '#' or tva_sale <> '#'
602 order by tva_id asc");
603 }
605 $r = "";
606 $r.=HtmlInput::title_box(_('Choisissez la TVA'),'tva_select',"close","","y");
607 $r.='<div >';
608 $r.=_('Cherche')." ".HtmlInput::filter_table("tva_select_table",'0,1,2,3' , 1);
609 $r.= '<TABLE class="sortable" style="width:100%" id="tva_select_table">';
610 $r.=th(_('id'),'class="sorttable_sorted"');
611 $r.=th(_('code'));
612 $r.=th(_('Taux'));
613 $r.=th(_('Symbole'));
614 $r.=th(_('Explication'));
615
616 for ($i = 0; $i < $Max; $i++)
617 {
619 if (!isset($compute))
620 {
621 if (!isset($code))
622 {
623 $script = "onclick=\"$('$ctl').value='" . $row['tva_id'] . "';removeDiv('tva_select');\"";
624 }
625 else
626 {
627 $script = "onclick=\"$('$ctl').value='" . $row['tva_id'] . "';set_value('$code','" . $row['tva_label'] . "');removeDiv('tva_select');\"";
628 }
629 }
630 else
631 {
632 if (!isset($code))
633 {
634 $script = "onclick=\"$('$ctl').value='" . $row['tva_id'] . "';removeDiv('tva_select');clean_tva('$compute');compute_ledger('$compute');\"";
635 }
636 else
637 {
638 $script = "onclick=\"$('$ctl').value='" . $row['tva_id'] . "';set_value('$code','" . $row['tva_label'] . "');removeDiv('tva_select');clean_tva('$compute');compute_ledger('$compute');\"";
639 }
640 }
641 $set = '<INPUT TYPE="BUTTON" class="button" Value="select" ' . $script . '>';
642 $class=($i%2 == 0)?' class="odd" ':' class="even" ';
643 $r.='<tr'.$class. $script.' style="cursor : pointer">';
644 $r.=td($row['tva_id']);
645 $r.=td($row['tva_code']);
646 $r.=td($row['tva_rate']);
647 $r.=td($row['tva_label']);
648 $r.=td($row['tva_comment']);
649 $r.='</tr>';
650 }
651 $r.='</TABLE>';
652 $r.=HtmlInput::button_close("tva_select");
653 $r.='</div>';
655
656 header('Content-type: text/xml; charset=UTF-8');
657 echo <<<EOF
658<?xml version="1.0" encoding="UTF-8"?>
659<data>
660<code>$html</code>
661<popup>$popup</popup>
662</data>
663EOF;
664 break;
665 case 'label_tva':
666 $code=$http->request('code','string','x');
668 $tva=Acc_Tva::build($cn, $id);
669
670 if ($tva->tva_id == -1 )
671 $value = _('tva inconnue');
672 else
673 {
674 $value=htmlentities($tva->tva_label);
675 }
676 header('Content-type: text/xml; charset=UTF-8');
677 echo <<<EOF
678<?xml version="1.0" encoding="UTF-8"?>
679<data>
680<code>$code</code>
682</data>
683EOF;
684
685 break;
686
687 case 'add_plugin':
688 $me_code = new IText('me_code');
689 $me_file = new IText('me_file');
690 $me_menu = new IText('me_menu');
691 $me_description = new IText("me_description");
692 $me_parameter = new IText("me_parameter");
693 $new = true;
694 require_once NOALYSS_INCLUDE.'/ajax/ajax_plugin_detail.php';
695 break;
696 case 'mod_plugin':
697 $m = $cn->get_array("select me_code,me_file,me_menu,me_description,me_parameter
698 from menu_ref where me_code=$1", array($me_code));
699 if (empty($m))
700 {
701 echo HtmlInput::title_box(_("Ce plugin n'existe pas "), $ctl,"close","","y");
702 echo "<p>"._("Il y a une erreur, ce plugin n'existe pas").
703 "</p>";
704 exit;
705 }
706 $me_code = new IText('me_code', $m[0] ['me_code']);
707 $me_file = new IText('me_file', $m[0] ['me_file']);
708 $me_menu = new IText('me_menu', $m[0] ['me_menu']);
709 $me_description = new IText("me_description", $m[0] ['me_description']);
710 $me_parameter = new IText("me_parameter", $m[0] ['me_parameter']);
711 $new = false;
712 require_once NOALYSS_INCLUDE.'/ajax/ajax_plugin_detail.php';
713 break;
714 case 'ledger_description':
715 $ajrn=$cn->get_array('select jrn_def_name,jrn_def_description from jrn_def where jrn_def_id=$1',array($l));
716 if ( count($ajrn)==1)
717 {
718 echo '<div>';
719 echo '<h1 >'.$ajrn[0]['jrn_def_name'].'</h1>';
720 if ( noalyss_trim($ajrn[0]['jrn_def_description']) != "") {
721 echo '<p style="border:1px solid;margin-top:0px;padding:1rem">'.$ajrn[0]['jrn_def_description'].'</p>';
722 }
723 echo '</div>';
724 }
725 exit();
726 break;
727 case 'currencyCode':
728 $ledger_id=$http->request('ledger',"number");
729 $code=$cn->get_value("select cr_code_iso from public.currency join jrn_def on (currency.id=jrn_def.currency_id) where jrn_def.jrn_def_id=$1",
730 [$ledger_id]);
731 echo $code;
732 break;
733 case 'up_other_tax':
735 $ledger_id=$http->request('jrn_id','number');
736 $acc_ledger=new Acc_Ledger($cn,$ledger_id);
737 echo $acc_ledger->input_additional_tax();
738 break;
739 default:
740 var_dump($_REQUEST);
741}
th($p_string, $p_extra='', $raw='')
Definition ac_common.php:58
ajax_disconnected($p_div)
Should a dialog box when you are disconnected from an ajax call propose to reload or to connect in an...
check_password_strength($password)
returns an double array with the error found and code , if the count is 0 then the password is very s...
set_language()
set the lang thanks the _SESSION['g_lang'] var.
td($p_string='', $p_extra='')
surround the string with td
Definition ac_common.php:83
noalyss_trim($p_string)
global $g_parameter
global $g_user
if no group available , then stop
for($i=0; $i< $nb_vatex_code; $i++)($i % 2==0) ? " odd " $cnt
if(headers_sent() &&DEBUGNOALYSS > 0) $html
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$op
if($notitle==0) $cal
catch(Exception $ex) if( $g_user->check_module( 'C0DEV')==0) switch($act) $jsson
check if module C0DEV
$a_answer
catch(Exception $e) $exercice
if(LOGINPUT) if($op=='widget') $path
for widget we call immediately a file outside the ajax folder
if(isNumber($jr_id)==0) $ledger_id
$_REQUEST['ac']
$new
if(! empty( $error)) for($i=0;$i< count($error);$i++)( $last !=$error[$i]) $last
_("actif, passif,charge,...")
$ex
$_GET['qcode']
$class
Display the Plugin and for each profile were it is installed or not.
the class Acc_Ledger_Fin inherits from Acc_Ledger, this object permit to manage the financial ledger
Class for jrn, class acc_ledger for manipulating the ledger AND some acc.
static build($db, $p_code)
retrieve TVA rate thanks the code that could be the tva_id or tva_code.
Display the calendar.
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
contains the class for connecting to Noalyss
static connect()
static button_close($div_name, $class='smallbutton')
close button for the HTML popup
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n', $raw="", $refresh='')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
manage the http input (get , post, request) and extract from an array
static set_firstDate($firstDate)
Generate the form for the periode Data Members.
Html Input Text member :
static set_vat_code(int $vat_code)
show the Numeric ID or the code
Class to manage the company parameter (address, name...)
Use one db for tracking progress bar value, the task id must be unique and let you follow the progres...
const ALL
Definition constant.php:210
$_POST['ac']
Definition do.php:323
for($e=0; $e< count($afiche); $e++) exit
$periode_start
Definition fiche.inc.php:60
$periode_end
Definition fiche.inc.php:61
$t_periode
escape_xml($p_xml)
When data are transfered thanks ajax in a xml document, the xml can not contains some character,...
json_response($p_answer)
Send header and json object.
if( $delta< 0) elseif( $delta==0)
$script
Definition popup.php:131