Improve Cat. of customer, adm...
This commit is contained in:
parent
064a9dc1f7
commit
f7ee929a1b
6 changed files with 77 additions and 94 deletions
|
|
@ -398,13 +398,8 @@ case 'ac':
|
|||
}
|
||||
|
||||
$html='';
|
||||
$html.="<h2>"._("Ajout d'une catégorie")." ".$msg."</h2>";
|
||||
/* show the form */
|
||||
$html.= '<div class="u_content">';
|
||||
$html.=$ctl;
|
||||
$html.= '<form id="newcat" name="newcat" method="post" onsubmit="this.ipopup=\''.$ipopup.'\';save_card_category(this);return false;">';
|
||||
$html.= dossier::hidden();
|
||||
$html.=HtmlInput::hidden('cat',$cat);
|
||||
|
||||
$search=new IPoste("class_base");
|
||||
$search->size=40;
|
||||
$search->value=$base;
|
||||
|
|
@ -413,17 +408,14 @@ case 'ac':
|
|||
$search->set_attribute('account',$search->name);
|
||||
$search->set_attribute('ipopup','ipop_account');
|
||||
|
||||
$nom_mod=new IText("nom_mod");
|
||||
$str_poste=$search->input();
|
||||
$submit=HtmlInput::submit('save',_('Sauve'));
|
||||
ob_start();
|
||||
require('template/category_of_card.php');
|
||||
$html.=ob_get_contents();
|
||||
ob_clean();
|
||||
$submit=HtmlInput::submit('save',_('Sauve'));
|
||||
$html.= '<p>';
|
||||
$html.= $submit;
|
||||
$html.= '</p>';
|
||||
$html.= '</form>';
|
||||
$html.= '</div>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -438,29 +430,29 @@ case 'scc':
|
|||
$html='';
|
||||
if ( $user->check_action(FICCAT) == 1 )
|
||||
{
|
||||
if ( strlen(trim($_POST['nom_mod'])) != 0 &&
|
||||
strlen(trim($_POST['class_base'])) != 0 )
|
||||
$script=create_script("removeDiv('$ctl')");
|
||||
$html.=$script;
|
||||
if ( strlen(trim($_GET['nom_mod'])) != 0 &&
|
||||
strlen(trim($_GET['class_base'])) != 0 )
|
||||
{
|
||||
$array=array("FICHE_REF"=>$cat,
|
||||
"nom_mod"=>$_POST['nom_mod'],
|
||||
"class_base"=>$_POST['class_base']);
|
||||
"nom_mod"=>$_GET['nom_mod'],
|
||||
"class_base"=>$_GET['class_base']);
|
||||
if ( isset ($_POST['create'])) $array['create']=1;
|
||||
$catcard=new Fiche_Def($cn);
|
||||
if ( $catcard->Add($array) == -1)
|
||||
$html.="alert('"._('Catégorie existe déjà')."')";
|
||||
$script="alert('"._('Catégorie existe déjà')."')";
|
||||
else
|
||||
$html.="alert('"._('Catégorie sauvée')."')";
|
||||
$html.=create_script($html);
|
||||
$script="alert('"._('Catégorie sauvée')."')";
|
||||
$html.=create_script($script);
|
||||
}
|
||||
else
|
||||
{
|
||||
$html.="alert('"._("Le nom et la classe base ne peuvent être vide")."')";
|
||||
$html.=create_script($html);
|
||||
$script="alert('"._("Le nom et la classe base ne peuvent être vide")."')";
|
||||
$html.=create_script($script);
|
||||
|
||||
$invalid=1;
|
||||
}
|
||||
$ipop=str_replace('_content','',$ctl);
|
||||
$html.=create_script('hideIPopup(\''.$ipop.'\');');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ function select_card_type(obj)
|
|||
filter=-1;
|
||||
}
|
||||
var content="select_card_div";
|
||||
if ( $(content)){ removeDiv(content);}
|
||||
if ( $(content)){removeDiv(content);}
|
||||
var sx=0;
|
||||
if ( window.scrollY)
|
||||
{
|
||||
|
|
@ -529,12 +529,29 @@ function save_card(obj)
|
|||
*/
|
||||
function add_category(obj)
|
||||
{
|
||||
var sx=0;
|
||||
if ( window.scrollY)
|
||||
{
|
||||
sx=window.scrollY+120;
|
||||
}
|
||||
else
|
||||
{
|
||||
sx=document.body.scrollTop+120;
|
||||
}
|
||||
|
||||
var div_style="top:"+sx+";width:60%;heigth:80%";
|
||||
// show ipopup
|
||||
showIPopup(obj.ipopup);
|
||||
var div={id:obj.ipopup,
|
||||
cssclass:"op_detail",drag:1,style:div_style};
|
||||
if ( $(div) ) {
|
||||
removeDiv(div);
|
||||
}
|
||||
add_div(div);
|
||||
waiting_box();
|
||||
var dossier=$('gDossier').value;
|
||||
var queryString='gDossier='+dossier;
|
||||
queryString+='&op=ac';
|
||||
queryString+='&ctl='+obj.ipopup+'_content';
|
||||
queryString+='&ctl='+obj.ipopup;
|
||||
if ( obj.type_cat)
|
||||
{
|
||||
queryString+='&cat='+obj.type_cat;
|
||||
|
|
@ -544,7 +561,7 @@ function add_category(obj)
|
|||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorFid,
|
||||
onSuccess:successFill_ipopcard
|
||||
onSuccess:fill_box
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -560,25 +577,29 @@ function save_card_category(obj)
|
|||
alert('Erreur pas d\' attribut ipopup '+obj.id);
|
||||
return;
|
||||
};
|
||||
var content=$(obj).ipopup+'_content';
|
||||
// Data must be taken here
|
||||
try {
|
||||
// Data must be taken here
|
||||
|
||||
data=$('newcat').serialize(false);
|
||||
$(content).innerHTML=loading();
|
||||
showIPopup($(obj).ipopup);
|
||||
var dossier=$('gDossier').value;
|
||||
var queryString='?';
|
||||
queryString+='&ctl='+content+'&';
|
||||
queryString='ctl='+obj.ipopup+'&';
|
||||
queryString+=data;
|
||||
queryString+='&op=scc'; // sc for save card
|
||||
|
||||
var action=new Ajax.Request ( 'ajax_card.php',
|
||||
{
|
||||
method:'post',
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorFid,
|
||||
onSuccess:successFill_ipopcard
|
||||
onSuccess:fill_box
|
||||
}
|
||||
);
|
||||
} catch(e)
|
||||
{
|
||||
alert(e.message);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
*@brief Remove a definition of an attribut
|
||||
|
|
|
|||
|
|
@ -292,47 +292,6 @@ function popup_recherche()
|
|||
var w=window.open("recherche.php?gDossier="+p_dossier+"&ac=SEARCH",'','statusbar=no,scrollbars=yes,toolbar=no');
|
||||
w.focus();
|
||||
}
|
||||
/**
|
||||
*@brief show the popup. The top property is adapted if you've scrolled the window
|
||||
*@param name of the object PHP IPopup
|
||||
*/
|
||||
function showIPopup(p_name)
|
||||
{
|
||||
var sx=0;
|
||||
if ( window.scrollY)
|
||||
{
|
||||
sx=window.scrollY+40;
|
||||
}
|
||||
else
|
||||
{
|
||||
sx=document.body.scrollTop+40;
|
||||
}
|
||||
$(p_name+'_border').style.top=sx;
|
||||
if ( g(p_name+'_fond') )
|
||||
{
|
||||
show(p_name+'_fond');
|
||||
}
|
||||
show(p_name+'_border');
|
||||
show(p_name+'_content');
|
||||
}
|
||||
/**
|
||||
*@brief hide the popup
|
||||
*@param name of the object PHP IPopup
|
||||
*/
|
||||
function hideIPopup(p_name)
|
||||
{
|
||||
g(p_name+'_content').innerHTML=loading();
|
||||
if (g(p_name+'_fond'))
|
||||
{
|
||||
hide(p_name+'_fond');
|
||||
}
|
||||
if (g(p_name+'_border'))
|
||||
{
|
||||
hide(p_name+'_border');
|
||||
}
|
||||
hide(p_name+'_content');
|
||||
|
||||
}
|
||||
/**
|
||||
*@brief replace the special characters (><'") by their HTML representation
|
||||
*@return a string without the offending char.
|
||||
|
|
|
|||
|
|
@ -80,9 +80,10 @@ if ( $low_action == "list" )
|
|||
$a=(isset($_GET['query']))?$_GET['query']:"";
|
||||
printf (_('Recherche').' <input class="input_text" type="text" name="query" value="%s">',
|
||||
$a);
|
||||
echo HtmlInput::request_to_hidden(array('ac'));
|
||||
$sel_card=new ISelect('cat');
|
||||
$sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
|
||||
' where frd_id='.FICHE_TYPE_ADM_TAX.
|
||||
' where frd_id='.FICHE_TYPE_ADM_TAX.' or frd_id ='.FICHE_TYPE_FIN.
|
||||
' order by fd_label ',1);
|
||||
$sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
|
||||
$sel_card->javascript=' onchange="submit(this);"';
|
||||
|
|
@ -90,7 +91,7 @@ if ( $low_action == "list" )
|
|||
|
||||
?>
|
||||
<input type="submit" class="button" name="submit_query" value="<?=_('recherche')?>">
|
||||
<input type="hidden" name="p_action" value="adm">
|
||||
<input type="hidden" name="p_action" value="adm">
|
||||
</form>
|
||||
</span>
|
||||
<?php
|
||||
|
|
@ -98,7 +99,7 @@ if ( $low_action == "list" )
|
|||
$search=(isset($_GET['query']))?$_GET['query']:"";
|
||||
$sql="";
|
||||
if ( isset($_GET['cat']))
|
||||
{
|
||||
{
|
||||
if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,17 +31,7 @@ require_once('class_iaction.php');
|
|||
require_once('class_fiche_def.php');
|
||||
require_once('class_ipopup.php');
|
||||
|
||||
echo ICard::ipopup('ipop_newcard');
|
||||
$ip_cat = new IPopup('ipop_cat');
|
||||
$ip_cat->title = _('Ajout d\'une catégorie');
|
||||
$ip_cat->value = '';
|
||||
echo $ip_cat->input();
|
||||
echo IPoste::ipopup('ipop_account');
|
||||
$search_card = new IPopup('ipop_card');
|
||||
$search_card->title = _('Recherche de fiche');
|
||||
$search_card->value = '';
|
||||
echo $search_card->input();
|
||||
echo ICard::ipopup('ipopcard');
|
||||
|
||||
|
||||
$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
|
||||
/* ! \file
|
||||
|
|
@ -134,14 +124,15 @@ if ($low_action == "list")
|
|||
$f_cat_button->label=_('Ajout d\'une catégorie');
|
||||
$f_cat_button->javascript='add_category(this)';
|
||||
echo $f_cat_button->input();
|
||||
echo '</div>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
}
|
||||
/*----------------------------------------------------------------------
|
||||
* Detail for a card, Suivi, Contact, Operation,... *
|
||||
* cc stands for customer card
|
||||
* cc stands for customer card
|
||||
*----------------------------------------------------------------------*/
|
||||
if ( $low_action == 'detail')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,20 @@
|
|||
<TABLE BORDER="0" CELLSPACING="0">
|
||||
<div style="float:right;height:10px;display:block;margin-top:2px;margin-right:2px">
|
||||
<?
|
||||
echo '<A style="background-color:blue;color:white;text-decoration:none" HREF="javascript:void(0)" onclick="removeDiv(\''.$ctl.'\');">Fermer</A>';
|
||||
?>
|
||||
</div>
|
||||
<? echo h2info(_("Ajout d'une catégorie").$msg); ?>
|
||||
|
||||
<div class="content">
|
||||
<form id="newcat" name="newcat" method="get" onsubmit="this.ipopup='<?=$ipopup?>';save_card_category(this);return false;">
|
||||
<?
|
||||
echo HtmlInput::get_to_hidden(array('gDossier','cat'));
|
||||
?>
|
||||
|
||||
<TABLE BORDER="0" CELLSPACING="0">
|
||||
<TR>
|
||||
<TD><?=_('Nom de la catégorie de fiche')?> </TD>
|
||||
<TD><INPUT TYPE="INPUT" NAME="nom_mod"></TD>
|
||||
<TD><?=$nom_mod->input()?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD> <?=_('Classe de base')?> </TD>
|
||||
|
|
@ -23,3 +36,9 @@
|
|||
<p class="info">
|
||||
<?=_(' A moins qu\'en créant la fiche, vous forcez un autre poste comptable')?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?=$submit?> <?=HtmlInput::button_close($ipopup)?>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue