When we ask to create a card, it is filtered now by ledger
This commit is contained in:
parent
f7027c9210
commit
8048e55955
6 changed files with 27 additions and 16 deletions
|
|
@ -133,13 +133,17 @@ case 'bc':
|
|||
/* ------------------------------------------------------------ */
|
||||
case 'st':
|
||||
$sql="select fd_id,fd_label from fiche_def";
|
||||
if ( isset($cat)) {
|
||||
$sql=$sql.sprintf(' where frd_id = '.FormatString ($cat));
|
||||
}
|
||||
if ( !isset($cat) && isset($fil) && strlen(trim($fil)) > 0 ){
|
||||
$sql=$sql.sprintf(" where fd_id in (%s)",
|
||||
FormatString($fil));
|
||||
}
|
||||
if ( $ledger != -1 ) {
|
||||
$l=new Acc_Ledger($cn,$ledger);
|
||||
$sql.=' where fd_id in ('.$l->get_all_fiche_def().')';
|
||||
} else
|
||||
if ( isset($cat)) {
|
||||
$sql=$sql.sprintf(' where frd_id = '.FormatString ($cat));
|
||||
} else
|
||||
if ( isset($fil) && strlen(trim($fil)) > 0 ){
|
||||
$sql=$sql.sprintf(" where fd_id in (%s)",
|
||||
FormatString($fil));
|
||||
}
|
||||
$array=$cn->make_array($sql);
|
||||
if ( empty($array)) {
|
||||
$html=_("Aucune catégorie de fiche ne correspondant à".
|
||||
|
|
|
|||
|
|
@ -269,13 +269,23 @@ function select_card_type(obj) {
|
|||
$(content).innerHTML='<image src="image/loading.gif" alt="chargement"></image>';
|
||||
showIPopup($(obj).ipopup);
|
||||
var dossier=$('gDossier').value;
|
||||
|
||||
// give a filter, -1 if not
|
||||
var filter=$(obj).filter;
|
||||
if ( filter==undefined) {filter=-1;}
|
||||
|
||||
|
||||
var queryString='?gDossier='+dossier;
|
||||
queryString+='&ctl='+content;
|
||||
queryString+='&op=st'; // st for selecting type
|
||||
if ( $(obj).win_refresh!=undefined) { queryString+='&ref';}
|
||||
queryString+='&fil='+filter;
|
||||
// filter on the ledger, -1 if not
|
||||
var oledger=$(obj).jrn;
|
||||
if (oledger==undefined) {ledger=-1;} else {ledger=g('p_jrn').value;}
|
||||
|
||||
queryString+='&ledger='+ledger;
|
||||
|
||||
if ( obj.type_cat) { queryString+='&cat='+obj.type_cat;}
|
||||
|
||||
var action=new Ajax.Request ( 'ajax_card.php',
|
||||
|
|
|
|||
|
|
@ -1314,8 +1314,7 @@ jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj
|
|||
$f_add_button=new IButton('add_card');
|
||||
$f_add_button->label=_('Créer une nouvelle fiche');
|
||||
$f_add_button->set_attribute('ipopup','ipop_newcard');
|
||||
$f_add_button->set_attribute('filter',$this->get_all_fiche_def ());
|
||||
// $f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->javascript=" select_card_type(this);";
|
||||
$ret.=$f_add_button->input();
|
||||
// show compute
|
||||
|
|
@ -1854,9 +1853,9 @@ jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj
|
|||
function get_all_fiche_def() {
|
||||
$sql="select jrn_def_fiche_deb as deb,jrn_def_fiche_cred as cred ".
|
||||
" from jrn_def where ".
|
||||
" jrn_def_type = $1 ";
|
||||
" jrn_def_id = $1 ";
|
||||
|
||||
$r=$this->db->exec_sql($sql,array($this->type));
|
||||
$r=$this->db->exec_sql($sql,array($this->id));
|
||||
|
||||
$res=Database::fetch_all($r);
|
||||
if ( empty($res) ) return null;
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$f_add_button=new IButton('add_card');
|
||||
$f_add_button->label=_('Créer une nouvelle fiche');
|
||||
$f_add_button->set_attribute('ipopup','ipop_newcard');
|
||||
$f_add_button->set_attribute('filter',$this->get_all_fiche_def ());
|
||||
$f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->javascript=" select_card_type(this);";
|
||||
$str_add_button=$f_add_button->input();
|
||||
|
||||
|
|
|
|||
|
|
@ -727,8 +727,7 @@ array
|
|||
$f_add_button=new IButton('add_card');
|
||||
$f_add_button->label=_('Créer une nouvelle fiche');
|
||||
$f_add_button->set_attribute('ipopup','ipop_newcard');
|
||||
$f_add_button->set_attribute('filter',$this->get_all_fiche_def ());
|
||||
// $f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->javascript=" select_card_type(this);";
|
||||
|
||||
$f_add_button2=new IButton('add_card2');
|
||||
|
|
|
|||
|
|
@ -858,8 +858,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$f_add_button=new IButton('add_card');
|
||||
$f_add_button->label=_('Créer une nouvelle fiche');
|
||||
$f_add_button->set_attribute('ipopup','ipop_newcard');
|
||||
$f_add_button->set_attribute('filter',$this->get_all_fiche_def ());
|
||||
// $f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->set_attribute('jrn',$this->id);
|
||||
$f_add_button->javascript=" select_card_type(this);";
|
||||
|
||||
$f_add_button2=new IButton('add_card2');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue