[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 85/219: Task #1349 : si une seule catégorie
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 85/219: Task #1349 : si une seule catégorie de fiche , alors on ne doit pas la choisir |
Date: |
Mon, 18 Dec 2017 13:22:42 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 77c37a8c8f7bf464f19afc55b0beab8c1a6a17bd
Author: Dany De Bontridder <address@hidden>
Date: Sun Oct 15 01:01:15 2017 +0200
Task #1349 : si une seule catégorie de fiche , alors on ne doit pas la
choisir
---
html/js/card.js | 14 ++++++++++++-
html/js/scripts.js | 25 ++++++++---------------
include/ajax/ajax_card.php | 51 ++++++++++++++++++++++++++++------------------
3 files changed, 52 insertions(+), 38 deletions(-)
diff --git a/html/js/card.js b/html/js/card.js
index ddd44cb..2297744 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -607,7 +607,19 @@ function select_card_type(obj)
parameters:queryString,
onFailure:errorFid,
onSuccess:function(req) {
-
+ // Get all the category,
+ var
answer=req.responseXML.getElementsByTagName("fiche_cat_item");
+ if (answer.length == 0) {
+ alert_box(req.responseText);
+ return;
+ }
+ if ( answer.length == 1) {
+ // There is only one category of card
+
dis_blank_card({"ctl":"div_new_card","fd_id":answer[0].firstChild.nodeValue,"op2":"bc","op":"card",gDossier:dossier});
+ removeDiv(content);
+ remove_waiting_box();
+ return;
+ }
fill_box(req);
$('lk_cat_card_table').focus();
}
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 83054b9..a62c757 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -2758,23 +2758,14 @@ function show_description(p_id)
}
/**
- * Hightlight the row we select and restore previous one
- * @param {type} x
- * @returns {undefined}
- */
-var old_class = null;
-var old_select = null;
-
-function select_cat(x)
-{
- if (old_select != null)
- {
- $(old_select).className = old_class;
- }
- old_select = $('select_cat_row_' + x);
- old_class = old_select.className;
- $(old_select).className = "highlight";
- $('fd_id').value = x;
+ * Display an empty card to fill , with the right card category
+ * @param pn_fiche_card_id : fiche_def.fd_id
+ * @param pn_dossier_id
+ */
+function select_cat(pn_fiche_card_id,pn_dossier_id)
+{
+
dis_blank_card({"ctl":"div_new_card","fd_id":pn_fiche_card_id,"op2":"bc","op":"card",gDossier:pn_dossier_id});
+ removeDiv('select_card_div');
}
/**
* Show the DIV and hide the other, the array of possible DIV are
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index 59b51da..ff85a92 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -248,16 +248,16 @@ case 'st':
sql_string($fil));
}
}
- if ( strpos($where," in ()") != 0)
- {
- $html=HtmlInput::anchor_close('select_card_div');
- $html.=h2info(_('Choix de la catégorie'));
- $html.='<h3 class="notice">';
- $html.=_("Aucune catégorie de fiche ne correspond à".
- " votre demande, le journal pourrait n'avoir accès à aucune
fiche");
- $html.='</h3>';
- break;
- }
+ if ( strpos($where," in ()") != 0)
+ {
+ $html=HtmlInput::anchor_close('select_card_div');
+ $html.=h2info(_('Choix de la catégorie'));
+ $html.='<h3 class="notice">';
+ $html.=_("Aucune catégorie de fiche ne correspond à".
+ " votre demande, le journal pourrait n'avoir accès à aucune
fiche");
+ $html.='</h3>';
+ break;
+ }
$sql.=" ".$where." order by fd_label";
$array=$cn->get_array($sql);
@@ -271,15 +271,14 @@ case 'st':
}
else
{
+ $list_fiche="";
$r='';
+
+ $r.='<div dd>';
$r.='<p style="padding-left:2em">';
$r.=_("Choisissez la catégorie de fiche à laquelle vous aimeriez
ajouter une fiche").'</p>';
- $r.='<div style="text-align:center">';
-
$msg=_('Choisissez une catégorie svp');
- $r.='<form id="sel_type" method="GET"
onsubmit="this.ipopup='.$ctl.";if ($('fd_id').value != 0 )
{dis_blank_card(this);return false;} else "
- . "{ $('error_cat').innerHTML='".$msg."'; return false;}\">" ;
$r.='<span id="error_cat" class="notice"></span>';
$r.=dossier::hidden();
$r.=(isset($ref))?HtmlInput::hidden('ref',1):'';
@@ -287,28 +286,40 @@ case 'st':
$r.='<table id="cat_card_table" class="result">';
for ($i=0;$i<count($array);$i++)
{
+
$list_fiche.=sprintf("<fiche_cat_item>%d</fiche_cat_item>",$array[$i]['fd_id']);
$class=($i%2==0)?' class="even" ':' class="odd" ';
$r.='<tr '.$class.' id="select_cat_row_'.$array[$i]['fd_id'].'">';
$r.='<td >';
- $r.='<a href="javascript:void(0)"
onclick="select_cat(\''.$array[$i]['fd_id'].'\')">'.h($array[$i]['fd_label']).'</a>';
+ $r.='<a href="javascript:void(0)"
onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.')">'.h($array[$i]['fd_label']).'</a>';
$r.='</td>';
$r.='<td>';
- $r.='<a href="javascript:void(0)"
onclick="select_cat(\''.$array[$i]['fd_id'].'\')">'.h($array[$i]['fd_description']).'</a>';
+ $r.='<a href="javascript:void(0)"
onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.')">'.h($array[$i]['fd_description']).'</a>';
$r.='</td>';
$r.="</tr>";
}
+
$r.='</table>';
$r.=HtmlInput::hidden('fd_id',0);
$r.='<p style="text-align:center">';
- $r.=HtmlInput::submit('st','choix');
- $r.=HtmlInput::button('Annuler',_('Annuler'),"
onclick=\"removeDiv('$ctl')\" ");
+ $r.=HtmlInput::button('Fermer',_('Fermer'),"
onclick=\"removeDiv('$ctl')\" ");
$r.='</p>';
- $r.='</form>';
$r.='</div>';
$html.=$r;
-
+
}
+ $xml=escape_xml($html);
+ header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl>$ctl</ctl>
+<code>$xml</code>
+<fiche_cat>{$list_fiche}</fiche_cat>
+</data>
+EOF;
+return;
+
break;
/*----------------------------------------------------------------------
* SC save card
- [Noalyss-commit] [noalyss] 50/219: task #0001467: Journaux VENTES - inversion D/C dans liste de catégorie de fiches, (continued)
- [Noalyss-commit] [noalyss] 50/219: task #0001467: Journaux VENTES - inversion D/C dans liste de catégorie de fiches, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 169/219: For MSIE, force to unicode (still problem with MSIE11) !, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 94/219: Fix background color for button 'modele operation', Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 139/219: Javascript : small error, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 42/219: SQL : protection injection, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 75/219: PRINTJRN Use new class http_input, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 82/219: Fix Doxygen issue : @example must be in a function otherwise the detailed section of Doxygen disappear, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 64/219: Inplace_Edit : cosmetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 137/219: Infobulle : avoid that the info balloon exceed limit of the display, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 193/219: SansationLight add the readme.txt file with license, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 85/219: Task #1349 : si une seule catégorie de fiche , alors on ne doit pas la choisir,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 07/219: Bug : cannot print action in profil Cannot add a export / printing in profile, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 79/219: PRINTGL : do not print accounting without operation, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 182/219: Icon move / fix, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 111/219: Comment Table, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 92/219: Esthetic : hide some columns when screen too small, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 39/219: Acc_Reconciliation : improve function get_amount_noautovat, set the prepare query inside the function, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 172/219: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 143/219: ANC : balance analytique / comptabilité, corrige bug SQL, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 155/219: Task #1493 Encodage VEN , ACH, Ordre des opérations Déplacement du bouton modèle d'opérations, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 130/219: ANC groupe : little bug in PLANANC, allow a group null, Dany De Bontridder, 2017/12/18