From e1e16dd36066dae8581c2c8a3d71f6e24e6b0896 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 23 Jun 2012 00:32:15 +0000 Subject: [PATCH] 0000577: Remplacer FICHE par PRINTCARD --- html/js/card.js | 47 +++- html/style-print.css | 36 +-- include/cfgfiche.inc.php | 3 +- include/class_database.php | 2 +- include/class_fiche.php | 11 +- include/fiche.inc.php | 442 +++++++++++++++++++++++-------------- sql/upgrade.sql | 7 +- 7 files changed, 349 insertions(+), 199 deletions(-) diff --git a/html/js/card.js b/html/js/card.js index f07ffd539..43cca1158 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -452,18 +452,22 @@ function select_card_type(obj) } /** *@brief Show a blank card - *@param Form object (obj) it must have the attribute ipopup + *@param Form object (obj) * possible attribute : * - filter is the filter but with a fd_id list, -1 means there is no filter * - ref : reload the window after adding card + * - content : name of the div + *@example dis_blank_card({gDossier:15,fd_id:12,ref:1}); *@see ajax_card.php */ function dis_blank_card(obj) { // first we have to take the form elt we need - var fd_id=$F('fd_id'); + if ( obj.fd_id == undefined ) { var fd_id=$F('fd_id'); } + else {fd_id=obj.fd_id;} + var ref=""; - if ( obj.elements['ref'] ) + if ( obj.elements && obj.elements['ref'] ) { ref='&ref'; } @@ -476,8 +480,10 @@ function dis_blank_card(obj) if ( $(content)) {removeDiv(content);} add_div(popup); - - var dossier=$('gDossier').value; + if ( obj.gDossier == undefined ) { + var dossier=$('gDossier').value;} else { + var dossier=obj.gDossier; + } var queryString='gDossier='+dossier; queryString+='&ctl='+content; @@ -494,6 +500,37 @@ function dis_blank_card(obj) } ); } +function form_blank_card(obj) +{ + // first we have to take the form elt we need + var fd_id=obj.fd_id; + var content='div_new_card'; + var nTop=posY-40; + var nLeft=posX-20; + var str_style="top:"+nTop+";left:"+nLeft+";width:60em;height:auto"; + + var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true}; + if ( $(content)) {removeDiv(content);} + add_div(popup); + + + var dossier=$('gDossier').value; + + var queryString='gDossier='+dossier; + queryString+='&ctl='+content; + queryString+='&fd_id='+fd_id; + queryString+='&op=bc'; // bc for blank card + + var action=new Ajax.Request ( 'ajax_card.php', + { + method:'get', + parameters:queryString, + onFailure:errorFid, + onSuccess:successFill_ipopcard + } + ); +} + /** *@brief save the data contained into the form 'save_card' *@param input field (obj) it must have the attribute ipopup diff --git a/html/style-print.css b/html/style-print.css index 43ba794aa..23bf62449 100644 --- a/html/style-print.css +++ b/html/style-print.css @@ -1,5 +1,5 @@ body { - font-size:7pt + font-size:7px; } select ,.input_text{ border:1px solid #FFFFFF; @@ -21,27 +21,29 @@ div.recherche_form { display:none; } table.result { - font-size:7pt; + font-size:7px; font-family:sans-serif; width:100% } table.result th { - font-size:7pt; + font-size:7px; font-family:sans-serif; } h2 { - font-size:12pt; + font-size:12px; font-weight:bold; font-family:sans-serif; } div.info { display:none; } - -h1,h2.info { - font-size:14pt; +.content { + font-size:7px; +} +h1.content,h1,h2.info { + font-size:14px; font-weight:bold; font-family:sans-serif; } @@ -89,20 +91,20 @@ div.debit{ display:none; } div.recherche{ - font-size:7pt; + font-size:7px; font-family:sans-serif; } div.redcontent{ - font-size:7pt; + font-size:7px; font-family:sans-serif; } div.redcontent{ - font-size:7pt; + font-size:7px; font-family:sans-serif; } div.ccontent{ - font-size:7pt; + font-size:7px; font-family:sans-serif; } div.rmenu { @@ -138,24 +140,24 @@ span.even { } tr.odd { - font-size:7pt; + font-size:7px; font-family:sans-serif; } tr { - font-size:7pt; + font-size:7px; font-family:sans-serif; } tr.even { - font-size:7pt; + font-size:7px; font-family:sans-serif; } td.odd{ - font-size:7pt; + font-size:7px; font-family:sans-serif; } td.even{ - font-size:7pt; + font-size:7px; font-family:sans-serif; } td.cell{ @@ -226,7 +228,7 @@ table.doc { } a.detail { -font-size:8pt; +font-size:8px; font-family:sans-serif; } diff --git a/include/cfgfiche.inc.php b/include/cfgfiche.inc.php index 83ae84dfe..53008e9c8 100644 --- a/include/cfgfiche.inc.php +++ b/include/cfgfiche.inc.php @@ -402,7 +402,6 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) $fiche_def->Get(); echo '

'.$fiche_def->label.'

'; $fiche=new Fiche($cn,0); - var_dump($_SERVER); echo '
'; echo dossier::hidden(); echo HtmlInput::hidden('ac',$_REQUEST['ac']); @@ -421,7 +420,7 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) // delete a card if (isset($_POST['delete']) ) { - $g_user->can_request(FIC); + $g_user->can_request(FICADD); ShowRecherche(); echo '
'; if ( $write ==0) diff --git a/include/class_database.php b/include/class_database.php index c335a9274..4ea403871 100644 --- a/include/class_database.php +++ b/include/class_database.php @@ -147,7 +147,7 @@ class Database } if ( ! $this->ret ) { - $str_error=pg_last_error($this->db). pg_result_error($this->db); + $str_error=pg_last_error($this->db). pg_result_error($this->ret); throw new Exception (" SQL ERROR $p_string ".$str_error,1 ); } diff --git a/include/class_fiche.php b/include/class_fiche.php index 867009d9e..a0bbf64ed 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -563,7 +563,7 @@ class Fiche $type_card = $this->cn->get_value('select fd_label from fiche_def join fiche using (fd_id) where f_id=$1', array($this->id)); $ret = ""; $ret.=h2( "Catégorie ".$type_card, 'style="display:inline"'); - $ret.=' id fiche:' . $this->id . ""; + $ret.=' id fiche:' . $this->id . ""; $ret.=""; if (empty($attr)) { @@ -1019,7 +1019,7 @@ class Fiche } /*!\brief remove a card */ - function remove() + function remove($silent=false) { if ( $this->id==0 ) return; // verify if that card has not been used is a ledger @@ -1034,11 +1034,14 @@ class Fiche if ( $this->cn->count_sql("select * from jrnx where j_qcode='".Database::escape_string($qcode)."'") != 0) { - alert('Impossible cette fiche est utilisée dans un journal'); - return; + if ( ! $silent ) { + alert('Impossible cette fiche est utilisée dans un journal'); + } + return 1; } $this->delete(); + return 0; } diff --git a/include/fiche.inc.php b/include/fiche.inc.php index f5b75faa6..715fb472f 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -1,4 +1,5 @@ value=$cn->make_array('select fd_id,fd_label from fiche_def order by fd_label'); -$categorie->selected=(isset($_GET['cat']))?$_GET['cat']:0; -$str_categorie=$categorie->input(); +$categorie = new ISelect('cat'); +$categorie->value = $cn->make_array('select fd_id,fd_label from fiche_def order by fd_label'); +$categorie->selected = (isset($_GET['cat'])) ? $_GET['cat'] : 0; +$str_categorie = $categorie->input(); -$icall=new ICheckBox("allcard",1); -$icall->selected=(isset($_GET['allcard']))?1:0; -$str_icall=$icall->input(); +$icall = new ICheckBox("allcard", 1); +$icall->selected = (isset($_GET['allcard'])) ? 1 : 0; +$str_icall = $icall->input(); /* periode */ -$exercice=$g_user->get_exercice(); -$iperiode=new Periode($cn); -list ($first,$last)=$iperiode->get_limit($exercice); +$exercice = $g_user->get_exercice(); +$iperiode = new Periode($cn); +list ($first, $last) = $iperiode->get_limit($exercice); -$periode_start=new IDate('start'); -$periode_end=new IDate('end'); +$periode_start = new IDate('start'); +$periode_end = new IDate('end'); -$periode_start->value=(isset($_GET['start']))?$_GET['start']:$first->first_day(); -$periode_end->value=(isset($_GET['end']))?$_GET['end']:$last->last_day(); +$periode_start->value = (isset($_GET['start'])) ? $_GET['start'] : $first->first_day(); +$periode_end->value = (isset($_GET['end'])) ? $_GET['end'] : $last->last_day(); -$str_start=$periode_start->input(); -$str_end=$periode_end->input(); +$str_start = $periode_start->input(); +$str_end = $periode_end->input(); /* histo ou summary */ -$histo=new ISelect('histo'); -$histo->value=array( - array('value'=>0,'label'=>_('Historique')), - array('value'=>1,'label'=>_('Historique Lettré')), - array('value'=>6,'label'=>_('Historique Lettré et montants différents')), - array('value'=>2,'label'=>_('Historique non Lettré')), - array('value'=>3,'label'=>_('Résumé')), - array('value'=>4,'label'=>_('Balance')), - array('value'=>5,'label'=>_('Balance non soldée' )) - ); -$histo->javascript='onchange="if (this.value==3) { +$histo = new ISelect('histo'); +$histo->value = array( + array('value' => -1, 'label' => _('Liste')), + array('value' => 0, 'label' => _('Historique')), + array('value' => 1, 'label' => _('Historique Lettré')), + array('value' => 6, 'label' => _('Historique Lettré et montants différents')), + array('value' => 2, 'label' => _('Historique non Lettré')), + array('value' => 3, 'label' => _('Résumé')), + array('value' => 4, 'label' => _('Balance')), + array('value' => 5, 'label' => _('Balance non soldée')) +); +$histo->javascript = 'onchange="if (this.value==3 || this.value==-1) { g("trstart").style.display="none";g("trend").style.display="none";g("allcard").style.display="none";} else {g("trstart").style.display="";g("trend").style.display="";g("allcard").style.display="";}"'; -$histo->selected=(isset($_GET['histo']))?$_GET['histo']:3; -$str_histo=$histo->input(); +$histo->selected = (isset($_GET['histo'])) ? $_GET['histo'] : -1; +$str_histo = $histo->input(); echo '
'; echo ''; echo dossier::hidden(); -echo HtmlInput::hidden('ac',$_GET['ac']); +echo HtmlInput::hidden('ac', $_GET['ac']); require_once('template/impress_cat_card.php'); -echo HtmlInput::submit('cat_display',_('Recherche')); +echo HtmlInput::submit('cat_display', _('Recherche')); echo ''; -$str="if (g('histo').value==3) { +$str = "if (g('histo').value==3 || g('histo').value== -1 ) { g('trstart').style.display='none';g('trend').style.display='none';g('allcard').style.display='none';} - else {g('trstart').style.display='';g('trend').style.display='';g('allcard').style.display='';}"; + else {g('trstart').style.display='';g('trend').style.display='';g('allcard').style.display='';} + if ( g('histo').value== -1 ) { g('allcard').style.display='';} + + "; echo create_script($str); echo '
'; //----------------------------------------------------- -if ( ! isset($_GET['cat_display'])) - exit(); +if (!isset($_GET['cat_display'])) + exit(); -$array=Fiche::get_fiche_def($cn,$_GET['cat'],'name_asc'); +$fd_id = $_GET['cat']; +$array = Fiche::get_fiche_def($cn, $_GET['cat'], 'name_asc'); + +$h_add_card_b = new IButton('add_card'); +$h_add_card_b->label = _('Créer une nouvelle fiche'); +$h_add_card_b->javascript = "dis_blank_card({gDossier:$gDossier,fd_id:$fd_id})"; +$str_add_card = ($g_user->check_action(FICADD) == 1) ? $h_add_card_b->input() : ""; /* * You show now the result */ -if ($array == null ) +if ($array == null) { - echo '

Aucune fiche trouvée

'; - exit(); + echo '

Aucune fiche trouvée

'; + echo $str_add_card; + exit(); } -$allcard=(isset($_GET['allcard']))?1:0; -// summary -if ( $_GET['histo'] == 3 ) +$allcard = (isset($_GET['allcard'])) ? 1 : 0; +/* * ********************************************************************************************************************************* + * Liste + * + * ******************************************************************************************************************************** */ +if ($_GET['histo'] == -1) { - $cat_card=new Fiche_Def($cn); - $cat_card->id=$_GET['cat']; - $aHeading=$cat_card->getAttribut(); - require_once('template/result_cat_card_summary.php'); - - $hid=new IHidden(); - echo '
'.dossier::hidden(). - HtmlInput::submit('bt_csv',"Export CSV"). - HtmlInput::hidden('act',"CSV:fiche"). - $hid->input("type","fiche"). - $hid->input("ac",$_REQUEST['ac']). - $hid->input("fd_id",$_REQUEST['cat']); - echo ""; - - exit(); -} -$export_pdf='
'; -$export_pdf.=HtmlInput::hidden('cat',$_GET['cat']); -$export_pdf.=HtmlInput::hidden('act',"PDF:fiche_balance"). -$export_pdf.=HtmlInput::hidden('start',$_GET['start']); -$export_pdf.=HtmlInput::hidden('end',$_GET['end']); -$export_pdf.=HtmlInput::hidden('histo',$_GET['histo']); -$export_pdf.=HtmlInput::request_to_hidden(array('allcard')); -$export_pdf.=dossier::hidden(); -$export_pdf.=HtmlInput::submit('pdf','Export en PDF'); -$export_pdf.=''; - -$export_print=HtmlInput::print_window(); - -$export_csv='
'; -$export_csv.=HtmlInput::hidden('cat',$_GET['cat']); -$export_csv.=HtmlInput::hidden('act','CSV:fiche_balance'); -$export_csv.=HtmlInput::hidden('start',$_GET['start']); -$export_csv.=HtmlInput::hidden('end',$_GET['end']); -$export_csv.=HtmlInput::hidden('histo',$_GET['histo']); -$export_csv.=HtmlInput::request_to_hidden(array('allcard')); -$export_csv.=dossier::hidden(); -$export_csv.=HtmlInput::submit('CSV','Export en CSV'); -$export_csv.=''; - -// Balance -if ( $_GET['histo'] == 4 || $_GET['histo']==5 ) -{ - if ( isDate($_REQUEST['start']) == null || isDate ($_REQUEST['end']) == null ) - { - echo h2('Date invalide !','class="error"'); - alert('Date invalide !'); - exit; - } - echo $export_pdf; - echo $export_csv; - echo $export_print; - - $fd=new Fiche_Def($cn,$_REQUEST['cat']); - if ( $allcard==0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false ) - { - echo alert("Cette catégorie n'ayant pas de poste comptable n'a pas de balance"); - exit; - } - // all card - if ($allcard==1) + $write = $g_user->check_action(FICADD); + /** + * If ask for move or delete + */ + if (isset($_POST['action'])) { - $afiche=$cn->get_array("select fd_id from vw_fiche_def where ad_id=".ATTR_DEF_ACCOUNT." order by fd_label asc"); + if ($write == 1) + { + $ack = $_POST['f_id']; + /** + * Move + */ + if (isset($_POST['move'])) + { + for ($i = 0; $i < count($ack); $i++) + { + $fiche = new Fiche($cn, $ack[$i]); + $fiche->move_to($_POST['move_to']); + } + } + /** + * Delete + */ + if (isset($_POST['delete'])) + { + $msg=""; + for ($i = 0; $i < count($ack); $i++) + { + $fiche = new Fiche($cn, $ack[$i]); + if ( $fiche->remove(true) == 1 ) + { + $msg.="\n ".$fiche->strAttribut(ATTR_DEF_QUICKCODE); + } + } + if ($msg != "") + { + echo h2("Fiche non effacées", ' class="error" '); + echo '

'." Ces fiches n'ont pas été effacées ".$msg; + } + } + } + else + { + echo NoAccess(); + } + } + $sql = "select f_id from fiche "; + if ($allcard == 1) + { + $cond = ""; } else { - $afiche[0]=array('fd_id'=>$_REQUEST['cat']); + $cond = " where fd_id = " . sql_string($_GET['cat']); + } + // Create nav bar + $max = $cn->get_value("select count(*) from fiche " . $cond); + + $step = $_SESSION['g_pagesize']; + $page = (isset($_GET['offset'])) ? $_GET['page'] : 1; + $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0; + $bar = navigation_bar($offset, $max, $step, $page); + $limit = ($step == -1 ) ? "" : " limit " . $step; + $res = $cn->exec_sql(" + select f_id, + (select ad_value from fiche_detail as fd1 where ad_id=1 and fd1.f_id=f.f_id) as name, + (select ad_value from fiche_detail as fd1 where ad_id=23 and fd1.f_id=f.f_id) as qcode + from fiche as f + $cond order by 1 offset $offset $limit + "); + $nb_line = Database::num_row($res); + require_once 'template/fiche_list.php'; + if ($write == 1 ) echo $str_add_card; + exit(); +} +/* * ********************************************************************************************************************************* + * Summary + * + * ******************************************************************************************************************************** */ +if ($_GET['histo'] == 3) +{ + $cat_card = new Fiche_Def($cn); + $cat_card->id = $_GET['cat']; + $aHeading = $cat_card->getAttribut(); + echo $str_add_card; + require_once('template/result_cat_card_summary.php'); + + $hid = new IHidden(); + echo '
' . dossier::hidden() . + HtmlInput::submit('bt_csv', "Export CSV") . + HtmlInput::hidden('act', "CSV:fiche") . + $hid->input("type", "fiche") . + $hid->input("ac", $_REQUEST['ac']) . + $hid->input("fd_id", $_REQUEST['cat']); + echo ""; + + exit(); +} +$export_pdf = '
'; +$export_pdf.=HtmlInput::hidden('cat', $_GET['cat']); +$export_pdf.=HtmlInput::hidden('act', "PDF:fiche_balance") . + $export_pdf.=HtmlInput::hidden('start', $_GET['start']); +$export_pdf.=HtmlInput::hidden('end', $_GET['end']); +$export_pdf.=HtmlInput::hidden('histo', $_GET['histo']); +$export_pdf.=HtmlInput::request_to_hidden(array('allcard')); +$export_pdf.=dossier::hidden(); +$export_pdf.=HtmlInput::submit('pdf', 'Export en PDF'); +$export_pdf.=''; + +$export_print = HtmlInput::print_window(); + +$export_csv = '
'; +$export_csv.=HtmlInput::hidden('cat', $_GET['cat']); +$export_csv.=HtmlInput::hidden('act', 'CSV:fiche_balance'); +$export_csv.=HtmlInput::hidden('start', $_GET['start']); +$export_csv.=HtmlInput::hidden('end', $_GET['end']); +$export_csv.=HtmlInput::hidden('histo', $_GET['histo']); +$export_csv.=HtmlInput::request_to_hidden(array('allcard')); +$export_csv.=dossier::hidden(); +$export_csv.=HtmlInput::submit('CSV', 'Export en CSV'); +$export_csv.=''; + +/******************************************************************************************************************************** + * Balance + * + **********************************************************************************************************************************/ +if ($_GET['histo'] == 4 || $_GET['histo'] == 5) +{ + if (isDate($_REQUEST['start']) == null || isDate($_REQUEST['end']) == null) + { + echo h2('Date invalide !', 'class="error"'); + alert('Date invalide !'); + exit; + } + echo $str_add_card; + echo $export_pdf; + echo $export_csv; + echo $export_print; + + $fd = new Fiche_Def($cn, $_REQUEST['cat']); + if ($allcard == 0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false) + { + echo alert("Cette catégorie n'ayant pas de poste comptable n'a pas de balance"); + exit; + } + // all card + if ($allcard == 1) + { + $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc"); + } + else + { + $afiche[0] = array('fd_id' => $_REQUEST['cat']); } - for ($e=0;$eexec_sql("select f_id,ad_value from fiche join fiche_detail using(f_id) where fd_id=$1 and ad_id=1 order by 2 ",array($afiche[$e]['fd_id'])); - if ( $cn->count()==0 ) + $ret = $cn->exec_sql("select f_id,ad_value from fiche join fiche_detail using(f_id) where fd_id=$1 and ad_id=1 order by 2 ", array($afiche[$e]['fd_id'])); + if ($cn->count() == 0) { - if ( $allcard==0) { + if ($allcard == 0) + { echo "Aucune fiche trouvée"; exit; } else continue; } - echo '

'.$cn->get_value("select fd_label from fiche_def where fd_id=$1",array($afiche[$e]['fd_id'])).'

'; + echo '

' . $cn->get_value("select fd_label from fiche_def where fd_id=$1", array($afiche[$e]['fd_id'])) . '

'; echo '
'; echo tr( - th('Quick Code'). - th('Libellé'). - th('Débit','style="text-align:right"'). - th('Crédit','style="text-align:right"'). - th('Solde','style="text-align:right"'). - th('D/C','style="text-align:right"') + th('Quick Code') . + th('Libellé') . + th('Débit', 'style="text-align:right"') . + th('Crédit', 'style="text-align:right"') . + th('Solde', 'style="text-align:right"') . + th('D/C', 'style="text-align:right"') ); - $idx=0; - for ($i=0;$i < Database::num_row($ret);$i++) + $idx = 0; + for ($i = 0; $i < Database::num_row($ret); $i++) { - $filter= " (j_date >= to_date('".$_REQUEST['start']."','DD.MM.YYYY') ". - " and j_date <= to_date('".$_REQUEST['end']."','DD.MM.YYYY')) "; - $aCard=Database::fetch_array($ret,$i); - $oCard=new Fiche($cn,$aCard['f_id']); - $solde=$oCard->get_solde_detail($filter); - if ( $solde['debit'] == 0 && $solde['credit']==0) continue; - /* only not purged card */ - if ($_GET['histo'] == 5 && $solde['debit'] == $solde['credit']) continue; - $class=''; - if ( $idx%2 == 0) $class='class="odd"'; + $filter = " (j_date >= to_date('" . $_REQUEST['start'] . "','DD.MM.YYYY') " . + " and j_date <= to_date('" . $_REQUEST['end'] . "','DD.MM.YYYY')) "; + $aCard = Database::fetch_array($ret, $i); + $oCard = new Fiche($cn, $aCard['f_id']); + $solde = $oCard->get_solde_detail($filter); + if ($solde['debit'] == 0 && $solde['credit'] == 0) + continue; + /* only not purged card */ + if ($_GET['histo'] == 5 && $solde['debit'] == $solde['credit']) + continue; + $class = ''; + if ($idx % 2 == 0) + $class = 'class="odd"'; $idx++; echo tr( - td(HtmlInput::history_card($oCard->id,$oCard->strAttribut(ATTR_DEF_QUICKCODE))). - td($oCard->strAttribut(ATTR_DEF_NAME)). - td(nbm($solde['debit']),'style="text-align:right"'). - td(nbm($solde['credit']),'style="text-align:right"'). - td(nbm(abs($solde['solde'])),'style="text-align:right"'). - td((($solde['debit']<$solde['credit'])?'CRED':'DEB'),'style="text-align:right"'), - $class + td(HtmlInput::history_card($oCard->id, $oCard->strAttribut(ATTR_DEF_QUICKCODE))) . + td($oCard->strAttribut(ATTR_DEF_NAME)) . + td(nbm($solde['debit']), 'style="text-align:right"') . + td(nbm($solde['credit']), 'style="text-align:right"') . + td(nbm(abs($solde['solde'])), 'style="text-align:right"') . + td((($solde['debit'] < $solde['credit']) ? 'CRED' : 'DEB'), 'style="text-align:right"'), $class ); - } echo '
'; } - echo $export_pdf; - echo $export_csv; - echo $export_print; + echo $str_add_card; + echo $export_pdf; + echo $export_csv; + echo $export_print; - exit(); + exit(); } -if ( isDate($_REQUEST['start']) == null || isDate ($_REQUEST['end']) == null ) +if (isDate($_REQUEST['start']) == null || isDate($_REQUEST['end']) == null) { - echo h2('Date invalide !','class="error"'); - alert('Date invalide !'); - exit; + echo h2('Date invalide !', 'class="error"'); + alert('Date invalide !'); + exit; } -//---------------------------------------------------------------------------- -// for the lettering / history -//---------------------------------------------------------------------------- - +/*********************************************************************************************************************************** + * Lettering + * + **********************************************************************************************************************************/ // all card -if ($allcard==1) +if ($allcard == 1) { - $afiche=$cn->get_array("select fd_id from vw_fiche_def where ad_id=".ATTR_DEF_ACCOUNT." order by fd_label asc"); + $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc"); } else { - $afiche[0]=array('fd_id'=>$_REQUEST['cat']); + $afiche[0] = array('fd_id' => $_REQUEST['cat']); } +echo $str_add_card; echo $export_csv; echo $export_pdf; echo $export_print; -$fiche=new Fiche($cn); +$fiche = new Fiche($cn); for ($e = 0; $e < count($afiche); $e++) { $array = Fiche::get_fiche_def($cn, $afiche[$e]['fd_id'], 'name_asc'); @@ -276,7 +382,7 @@ for ($e = 0; $e < count($afiche); $e++) { $letter->get_unletter(); } - if ( $_GET['histo'] == 6 ) + if ($_GET['histo'] == 6) { $letter->get_letter_diff(); } @@ -285,7 +391,7 @@ for ($e = 0; $e < count($afiche); $e++) continue; $detail_card = HtmlInput::card_detail($row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME)); - echo '

' . $detail_card . '

'; + echo '

' . $detail_card . '

'; echo ''; echo ''; @@ -326,14 +432,15 @@ for ($e = 0; $e < count($afiche); $e++) $amount_cred+=$row['j_montant']; $prog = bcsub($prog, $row['j_montant']); } - $side=" ".$fiche->get_amount_side($prog); - echo td(nbm($prog).$side, 'style="text-align:right"'); + $side = " " . $fiche->get_amount_side($prog); + echo td(nbm($prog) . $side, 'style="text-align:right"'); if ($row['letter'] != -1) - { - $span_error=""; - if ( $row['letter_diff'] != 0 ) $span_error=$g_failed; - echo td($row['letter'].$span_error); - } + { + $span_error = ""; + if ($row['letter_diff'] != 0) + $span_error = $g_failed; + echo td($row['letter'] . $span_error); + } else echo td(''); echo ''; @@ -359,10 +466,9 @@ for ($e = 0; $e < count($afiche); $e++) echo '
'; } } +echo $str_add_card; echo $export_csv; echo $export_pdf; echo $export_print; - - ?> diff --git a/sql/upgrade.sql b/sql/upgrade.sql index d8d8c42be..1bf2e2186 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -472,5 +472,8 @@ CREATE INDEX quant_sold_jrn_fki create sequence uos_pk_seq; create table tool_uos ( uos_value bigint default nextval ('uos_pk_seq') primary key ); -update menu_ref set me_code='CFGCARD',me_file='cfgfiche.inc.php' where me_code='CARD'; -update menu_ref set me_code='CARD',me_file='fiche.inc.php' where me_code='PRINTCARD'; +-- update menu_ref set me_code='CFGCARD',me_file='cfgfiche.inc.php' where me_code='CARD'; +-- update menu_ref set me_code='CARD',me_file='fiche.inc.php' where me_code='PRINTCARD'; +-- update profile_menu set me_code='CARD' where me_code='CFGCARD'; +-- update profile_menu set me_code='CFGCARD' , me_code_dep='PARAM' where me_code='CARD' and me_code_dep='PRINT'; +-- update menu_ref set me_menu='Fiche',me_description='Liste,Balance,Historique par fiche' where me_code='CARD'