phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r5197 - in phpcompta/tags/rel650: html html/js include i


From: phpcompta-dev
Subject: [Phpcompta-dev] r5197 - in phpcompta/tags/rel650: html html/js include include/template
Date: Wed, 27 Mar 2013 23:25:35 +0100 (CET)

Author: danydb
Date: 2013-03-27 23:25:34 +0100 (Wed, 27 Mar 2013)
New Revision: 5197

Added:
   phpcompta/tags/rel650/include/ajax_view_action.php
Modified:
   phpcompta/tags/rel650/html/ajax_misc.php
   phpcompta/tags/rel650/html/js/acc_ledger.js
   phpcompta/tags/rel650/html/js/scripts.js
   phpcompta/tags/rel650/include/class_follow_up.php
   phpcompta/tags/rel650/include/class_html_input.php
   phpcompta/tags/rel650/include/template/action_search.php
   phpcompta/tags/rel650/include/template/dashboard.php
   phpcompta/tags/rel650/include/template/detail-action.php
   phpcompta/tags/rel650/include/template/ledger_detail_bottom.php
Log:
0000801: Ajouter un lien vers l'action

Modified: phpcompta/tags/rel650/html/ajax_misc.php
===================================================================
--- phpcompta/tags/rel650/html/ajax_misc.php    2013-03-27 19:22:53 UTC (rev 
5196)
+++ phpcompta/tags/rel650/html/ajax_misc.php    2013-03-27 22:25:34 UTC (rev 
5197)
@@ -565,6 +565,9 @@
        case 'fddetail':
                require_once 'ajax_fiche_def_detail.php';
                break;
+       case 'vw_action':
+               require_once 'ajax_view_action.php';
+               break;
        default:
                var_dump($_GET);
 }

Modified: phpcompta/tags/rel650/html/js/acc_ledger.js
===================================================================
--- phpcompta/tags/rel650/html/js/acc_ledger.js 2013-03-27 19:22:53 UTC (rev 
5196)
+++ phpcompta/tags/rel650/html/js/acc_ledger.js 2013-03-27 22:25:34 UTC (rev 
5197)
@@ -324,6 +324,7 @@
         a=trim(g("e_march"+p_ctl_nb+'_tva_amount').value);
         g("e_march"+p_ctl_nb+'_tva_amount').value=a;
     }
+       if ( ! document.getElementById("e_march"+p_ctl_nb))  {return;}
     g("e_march"+p_ctl_nb).value=trim(g("e_march"+p_ctl_nb).value);
     var qcode=g("e_march"+p_ctl_nb).value;
 
@@ -375,12 +376,12 @@
     for (var i=0;i<g("nb_item").value;i++)
     {
         if( g('tva_march'+i))  tva+=g('tva_march'+i).value*1;
-        htva+=g('htva_march'+i).value*1;
-        tvac+=g('tvac_march'+i).value*1;
+        if (g('htva_march'+i)) htva+=g('htva_march'+i).value*1;
+        if (g('tvac_march'+i)) tvac+=g('tvac_march'+i).value*1;
     }
 
     if ( g('tva') ) g('tva').innerHTML=Math.round(tva*100)/100;
-    g('htva').innerHTML=Math.round(htva*100)/100;
+    if (g('htva')) g('htva').innerHTML=Math.round(htva*100)/100;
     if (g('tvac'))    g('tvac').innerHTML=Math.round(tvac*100)/100;
 }
 /**
@@ -449,8 +450,8 @@
     for (var i=0;i<g("nb_item").value;i++)
     {
         if ( g('tva_march') ) tva+=g('tva_march'+i).value*1;
-        htva+=g('htva_march'+i).value*1;
-        tvac+=g('tvac_march'+i).value*1;
+        if( g('htva_march'+i)) htva+=g('htva_march'+i).value*1;
+        if( g('tvac_march'+i))tvac+=g('tvac_march'+i).value*1;
     }
 
     if ( g('tva') ) g('tva').innerHTML=Math.round(tva*100)/100;

Modified: phpcompta/tags/rel650/html/js/scripts.js
===================================================================
--- phpcompta/tags/rel650/html/js/scripts.js    2013-03-27 19:22:53 UTC (rev 
5196)
+++ phpcompta/tags/rel650/html/js/scripts.js    2013-03-27 22:25:34 UTC (rev 
5197)
@@ -1674,4 +1674,42 @@
 {
        var str_date=$(p_id_date).value;
        return check_date(str_date);
+}
+/**
+ *
+ * @param ag_id to view
+ * @param dossier is the folder
+ * @param modify : show the modify button values : 0 for no 1 for yes
+ */
+function view_action(ag_id,dossier,modify)
+{
+       waiting_box();
+       layer++;
+       id = 'action' + layer;
+
+       querystring = 'gDossier=' + dossier + '&op=vw_action&ag_id=' + ag_id + 
'&div=' + id+'&mod='+modify;
+       var action = new Ajax.Request(
+                       "ajax_misc.php",
+                       {
+                               method: 'get',
+                               parameters: querystring,
+                               onFailure: error_box,
+                               onSuccess: function(req) {
+                                       try {
+                                               remove_waiting_box();
+                                               var pos = fixed_position(0, 50) 
+ ";width:90%;left:5%;";
+                                               add_div({
+                                                       id: id,
+                                                       drag: 1,
+                                                       cssclass: "inner_box",
+                                                       style: pos
+                                               });
+                                               $(id).innerHTML = 
req.responseText;
+                                               compute_all_ledger();
+                                       } catch (e) {
+                                               alert(e.message);
+                                       }
+                               }
+                       }
+       );
 }
\ No newline at end of file

Added: phpcompta/tags/rel650/include/ajax_view_action.php
===================================================================
--- phpcompta/tags/rel650/include/ajax_view_action.php                          
(rev 0)
+++ phpcompta/tags/rel650/include/ajax_view_action.php  2013-03-27 22:25:34 UTC 
(rev 5197)
@@ -0,0 +1,55 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show the detail of an action
+ *
+ */
+require_once 'class_follow_up.php';
+echo HtmlInput::title_box(_("Détail action"), $div);
+$act = new Follow_Up($cn);
+$act->ag_id = $ag_id;
+$act->get();
+if ($g_user->can_write_action($ag_id) == true || 
$g_user->can_read_action($ag_id) == true || $act->ag_dest == -1)
+{
+       echo $act->Display('READ', false, "ajax", "");
+       $action=HtmlInput::array_to_string(array("gDossier","ag_id"), 
$_GET)."&ac=FOLLOW&sa=detail";
+       if ( $_GET['mod']== 1) :
+       ?>
+<a href="<?=$action?>" target="_blank" class="button">Modifier </a>
+    <?
+       endif;
+}
+else
+{
+       echo h2(_("Ce document n'est pas accessible"),"error");
+       ?>
+       <div style="margin:0;padding:0;background-color:red;text-align:center;">
+<h2 class="error">Accès interdit : vous n'avez pas accès à cette information, 
contactez votre responsable</h2>;
+</div>
+       <?
+}
+echo HtmlInput::button_close($div);
+
+?>
\ No newline at end of file

Modified: phpcompta/tags/rel650/include/class_follow_up.php
===================================================================
--- phpcompta/tags/rel650/include/class_follow_up.php   2013-03-27 19:22:53 UTC 
(rev 5196)
+++ phpcompta/tags/rel650/include/class_follow_up.php   2013-03-27 22:25:34 UTC 
(rev 5197)
@@ -114,7 +114,7 @@
         *        it is a new document
         *
         * \param $p_view if set to true the form will be in readonly mode 
(value: true or false)
-        * \param $p_gen true we show the tag for generating a doc (value : 
true or false)
+        * \param $p_gen true we show the tag for generating a doc (value : 
true or false) and adding files
         * \param $p_base is the ac parameter
         * \param $retour is the html code for the return button
         * \note  update the reference number or the document type is not 
allowed
@@ -414,7 +414,7 @@
                /* TVA */
                $itva = new ITva_Popup($this->db);
                $itva->in_table = true;
-
+               $aCard=array();
                /* create aArticle for the detail section */
                for ($i = 0; $i < MAX_ARTICLE; $i++)
                {
@@ -428,6 +428,7 @@
                        $tmp_ad = (isset($this->aAction_detail[$i])) ? 
$this->aAction_detail[$i] : false;
                        $icard->readOnly=$readonly;
                        $icard->value = '';
+                       $aCard[$i]=0;
                        if ($tmp_ad)
                        {
                                $march = new Fiche($this->db);
@@ -436,6 +437,7 @@
                                {
                                        $march->id = $f;
                                        $icard->value = 
$march->get_quick_code();
+                                       $aCard[$i]=$f;
                                }
                        }
                        $icard->set_dblclick("fill_ipopcard(this);");
@@ -1392,5 +1394,16 @@
                                )
                        );
        }
-
+       static function get_all_operation($p_jr_id)
+       {
+               global $cn;
+               $array=$cn->get_array("
+                       select ag_id,ag_ref,
+                               ag_title
+                               from action_gestion
+                               join action_gestion_operation using(ag_id)
+                               where
+                               jr_id=$1",array($p_jr_id));
+               return $array;
+       }
 }

Modified: phpcompta/tags/rel650/include/class_html_input.php
===================================================================
--- phpcompta/tags/rel650/include/class_html_input.php  2013-03-27 19:22:53 UTC 
(rev 5196)
+++ phpcompta/tags/rel650/include/class_html_input.php  2013-03-27 22:25:34 UTC 
(rev 5197)
@@ -235,6 +235,18 @@
         return sprintf('<A class="detail" 
style="text-decoration:underline;display:inline" 
HREF="javascript:modifyOperation(%d,%d)">%s</A>',
                        $p_jr_id,dossier::id(),$p_mesg);
     }
+       /**
+        * @brief return an anchor to view the detail of an action
+        * @param $ag_id
+        * @param $p_mesg
+        * @param $p_modify let you modify an operation
+        *
+        */
+        static function detail_action($ag_id,$p_mesg,$p_modify=1)
+    {
+        return sprintf('<A class="detail" 
style="text-decoration:underline;display:inline" 
HREF="javascript:view_action(%d,%d,%d)">%s</A>',
+                       $ag_id,dossier::id(),$p_modify,$p_mesg);
+    }
     /**
      * return a string containing the html code for calling the 
modifyModeleDocument
      */

Modified: phpcompta/tags/rel650/include/template/action_search.php
===================================================================
--- phpcompta/tags/rel650/include/template/action_search.php    2013-03-27 
19:22:53 UTC (rev 5196)
+++ phpcompta/tags/rel650/include/template/action_search.php    2013-03-27 
22:25:34 UTC (rev 5197)
@@ -79,7 +79,7 @@
                                <td ><?= $w->input() . $w->search()?><span 
id="<?=$label?>"></span></td>
                        <tr>
                        <tr>
-                               <td style="text-align:right" ><?= 
_("Profile")?></td>
+                               <td style="text-align:right" ><?= 
_("Profil")?></td>
                                <td><?= $str_ag_dest?></td>
                        </tr>
                        <tr>

Modified: phpcompta/tags/rel650/include/template/dashboard.php
===================================================================
--- phpcompta/tags/rel650/include/template/dashboard.php        2013-03-27 
19:22:53 UTC (rev 5196)
+++ phpcompta/tags/rel650/include/template/dashboard.php        2013-03-27 
22:25:34 UTC (rev 5197)
@@ -68,9 +68,7 @@
        for($i=0;$i<count($last_operation);$i++):
        ?>
        <li>
-               <span>
-                       <?=h($last_operation[$i]['ag_ref'])?>
-               </span>
+               
<?=HtmlInput::detail_action($last_operation[$i]['ag_id'],h($last_operation[$i]['ag_ref']))?>
        <span>
        <?=smaller_date($last_operation[$i]['ag_timestamp_fmt'])?>
        </span>
@@ -98,9 +96,7 @@
        for($i=0;$i<count($late_operation);$i++):
        ?>
        <li>
-               <span>
-                       <?=h($late_operation[$i]['ag_ref'])?>
-               </span>
+               
<?=HtmlInput::detail_action($last_operation[$i]['ag_id'],h($last_operation[$i]['ag_ref']))?>
        <span>
        <?=smaller_date($late_operation[$i]['ag_timestamp_fmt'])?>
        </span>

Modified: phpcompta/tags/rel650/include/template/detail-action.php
===================================================================
--- phpcompta/tags/rel650/include/template/detail-action.php    2013-03-27 
19:22:53 UTC (rev 5196)
+++ phpcompta/tags/rel650/include/template/detail-action.php    2013-03-27 
22:25:34 UTC (rev 5197)
@@ -254,17 +254,38 @@
 <? endif; ?>
   </div>
 </div>
+<? if ( $p_base != 'ajax' ) :?>
 <input type='button' class="button" class="noprint" value='Montrer articles' 
id="toggleButton" onclick='toggleShowDetail()'>
+<? endif; ?>
+<?
+/**
+ * check if there card to show,
+ */
+$show_row=0;
+for ($i=0;$i<count($aArticle);$i++) :
+       if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ 
$show_row=1;break;}
+endfor;
+?>
+<?
+/*
+ * display detail if there card or if we are in UPDATE or NEW mode
+ */
+if ($show_row !=0 ) :
+
+       ?>
 <fieldset id="fldDetail" style='display:block'>
    <LEGEND> <?=_('Détail des articles')?>
 </LEGEND>
 <?php // hidden fields
+$show_row=0;
 for ($i=0;$i<count($aArticle);$i++) :
        echo $aArticle[$i]['ad_id'];
        echo $aArticle[$i]['hidden_tva'];
        echo $aArticle[$i]['hidden_htva'];
+       if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ 
$show_row=1;}
 endfor;
 ?>
+
 <table id="art" >
 <tr>
   <th><?=_('Fiche')?></th>
@@ -276,8 +297,11 @@
 <th><?=_('Montant TVAC')?></th>
 
 </tr>
-
 <?for ($i=0;$i<count($aArticle);$i++): ?>
+<?
+if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'):
+       $show_row++;
+       ?>
 <TR>
 <TD><?php echo $aArticle[$i]['fid'] ?></TD>
 <TD><?php echo $aArticle[$i]['desc'] ?></TD>
@@ -286,10 +310,11 @@
 <TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
 <TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
 <TD class="num"><?php echo $aArticle[$i]['tvac'] ?></TD>
-
 </TR>
+<? endif; ?>
 <?php endfor; ?>
 </table>
+
 <script language="JavaScript">
 if ( $('e_march0') && $('e_march0').value =='') { toggleShowDetail();}
 function toggleShowDetail() {
@@ -301,6 +326,7 @@
        }
 
 </script>
+<? if ( $show_row != 0 ): ?>
 <div style="float: left; text-align: right; padding-right: 5px; font-size: 
1.2em; font-weight: bold; color: blue;">
   <input name="act" id="act" class="button" value="<?=_('Actualiser')?>" 
onclick="compute_all_ledger();" type="button">
 
@@ -316,8 +342,9 @@
     <br>Total TVAC
  </div>
 </div>
-
+<? endif; ?>
 </fieldset>
+<?endif; ?>
 
 <? if ($p_view != 'READ' && $str_select_doc != '') : ?>
 <fieldset class="noprint" >
@@ -366,6 +393,7 @@
 catch(exception) { alert('<?=j(_('Je ne peux pas ajouter de fichier'))?>'); 
alert(exception.message);}
 }
 </script>
+<? if ($p_view != 'READ') : ?>
   <div class="noprint">
      <h3 >Fichiers à ajouter: </h3>
     <ol id='add_file'  >
@@ -375,8 +403,9 @@
       </li>
     </ol>
   <span   >
-<? if ($p_view != 'READ') : ?> <input type="button" class="button" 
onclick="addFiles();" value="Ajouter un fichier"> <? endif;?>
+ <input type="button" class="button" onclick="addFiles();" value="Ajouter un 
fichier">
   </span>
   </div>
+ <? endif;?>
 </fieldset>
 <script>compute_all_ledger()</script>
\ No newline at end of file

Modified: phpcompta/tags/rel650/include/template/ledger_detail_bottom.php
===================================================================
--- phpcompta/tags/rel650/include/template/ledger_detail_bottom.php     
2013-03-27 19:22:53 UTC (rev 5196)
+++ phpcompta/tags/rel650/include/template/ledger_detail_bottom.php     
2013-03-27 22:25:34 UTC (rev 5197)
@@ -44,10 +44,37 @@
     echo $wConcerned->input();
 
 }
-
 ?>
 </div>
 <?
+$array = Follow_Up::get_all_operation($jr_id);
+if (count($array) > 0)
+{
+       ?>
+       <div class="myfieldset">
+               <h1 class="legend">Actions liées</h1>
+       <?
+       /**
+        * show eventually action
+        */
+       $array = Follow_Up::get_all_operation($jr_id);
+       echo '<ul style="list-style-type:square;">';
+       for ($i = 0; $i < count($array); $i++)
+       {
+               if ( $div == 'popup')
+               {
+                       echo 
'<li>'.HtmlInput::detail_action($array[$i]['ag_id'], h($array[$i]['ag_ref']." 
".$array[$i]['ag_title']),0).'</li>';
+               }
+               else
+               {
+                       echo 
'<li>'.HtmlInput::detail_action($array[$i]['ag_id'], h($array[$i]['ag_ref']." 
".$array[$i]['ag_title']),1).'</li>';
+               }
+       }
+       echo '</ul>';
+}
+?>
+</div>
+<?
 
 require_once('template/ledger_detail_file.php');
 ?>
@@ -62,7 +89,12 @@
 }
 
 ?>
-<?if ( $access=='W') {
+<?
+
+/**
+ * if you can write
+ */
+  if ( $access=='W') {
   echo HtmlInput::submit('save',_('Sauver'),'onClick="return 
verify_ca(\'popup\');"');
   $owner=new Own($cn);
   if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]