[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r5574 - in phpcompta/tags/rel670: html html/js include i
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r5574 - in phpcompta/tags/rel670: html html/js include include/template sql |
Date: |
Fri, 6 Dec 2013 14:38:08 +0100 (CET) |
Author: danydb
Date: 2013-12-06 14:38:08 +0100 (Fri, 06 Dec 2013)
New Revision: 5574
Modified:
phpcompta/tags/rel670/html/js/gestion.js
phpcompta/tags/rel670/html/js/scripts.js
phpcompta/tags/rel670/html/show_document.php
phpcompta/tags/rel670/include/class_document.php
phpcompta/tags/rel670/include/class_follow_up.php
phpcompta/tags/rel670/include/template/detail-action.php
phpcompta/tags/rel670/sql/upgrade.sql
Log:
task #0000919: FOLLOW : description des fichiers joints
Task #919 - FOLLOW : description des fichiers joints
Modified: phpcompta/tags/rel670/html/js/gestion.js
===================================================================
--- phpcompta/tags/rel670/html/js/gestion.js 2013-12-06 12:01:05 UTC (rev
5573)
+++ phpcompta/tags/rel670/html/js/gestion.js 2013-12-06 13:38:08 UTC (rev
5574)
@@ -33,7 +33,7 @@
*/
function remove_document(p_dossier,p_id)
{
- queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id;
+ var queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id;
var action=new Ajax.Request (
"show_document.php",
{
@@ -47,6 +47,32 @@
}
/**
+ address@hidden update the description of an attached document of an action
+ address@hidden dossier
+ address@hidden dt_id id of the document (pk document:d_id)
+*/
+function update_document(p_dossier,p_id)
+{
+ var queryString="gDossier="+p_dossier+"&a=upd_doc&d_id="+p_id;
+ queryString+="&value="+$('input_desc_txt'+p_id).value;
+ var action=new Ajax.Request (
+ "show_document.php",
+ {
+ method:'get',
+ parameters:queryString,
+ onFailure:errorRemoveDoc,
+ onSuccess:function(req){
+ $('input_desc'+p_id).hide();
+
$('print_desc'+p_id).innerHTML=$('input_desc_txt'+p_id).value+'<a
class="mtitle" style="color:orange" id="desc'+p_id+'
onclick="javascript:show_description('+p_id+'">Modifier</a>';
+ $('print_desc'+p_id).show();
+ }
+ }
+
+ );
+ return false;
+}
+
+/**
address@hidden remove the concerned operation of an action
address@hidden dossier
address@hidden p_id id pk action_comment_operation
Modified: phpcompta/tags/rel670/html/js/scripts.js
===================================================================
--- phpcompta/tags/rel670/html/js/scripts.js 2013-12-06 12:01:05 UTC (rev
5573)
+++ phpcompta/tags/rel670/html/js/scripts.js 2013-12-06 13:38:08 UTC (rev
5574)
@@ -2519,4 +2519,10 @@
alert(e.message);
}
+}
+function show_description(p_id)
+{
+ $('print_desc'+p_id).hide();
+ $('input_desc'+p_id).show();
+
}
\ No newline at end of file
Modified: phpcompta/tags/rel670/html/show_document.php
===================================================================
--- phpcompta/tags/rel670/html/show_document.php 2013-12-06 12:01:05 UTC
(rev 5573)
+++ phpcompta/tags/rel670/html/show_document.php 2013-12-06 13:38:08 UTC
(rev 5574)
@@ -61,6 +61,19 @@
header("Content-type: text/html; charset: utf8", true);
print $json;
}
+/* update the description of the document */
+if ( $action == "upd_doc")
+{
+ if ($g_user->check_action(VIEWDOC) == 1)
+ {
+ $doc = new Document($cn, $_REQUEST['d_id']);
+ $doc->get();
+ if ( $g_user->can_write_action($doc->ag_id))
+ // retrieve the document
+ $doc->update_description(strip_tags ($_REQUEST['value']));
+ }
+
+}
/* remove the operation from action_gestion_operation */
if ($action == 'rmop')
{
Modified: phpcompta/tags/rel670/include/class_document.php
===================================================================
--- phpcompta/tags/rel670/include/class_document.php 2013-12-06 12:01:05 UTC
(rev 5573)
+++ phpcompta/tags/rel670/include/class_document.php 2013-12-06 13:38:08 UTC
(rev 5574)
@@ -38,6 +38,7 @@
var $d_mimetype; /*!< $d_mimetype */
var $d_filename; /*!< $d_filename */
var $d_lob; /*!< $d_lob the oid of the lob */
+ var $d_description; /*!< Description of the file*/
var $d_number; /*!< $d_number number of the document */
var $md_id; /*!< $md_id document's template */
/* Constructor
@@ -370,10 +371,10 @@
$this->d_lob=$oid;
$this->d_filename=$_FILES['file_upload']['name'][$i];
$this->d_mimetype=$_FILES['file_upload']['type'][$i];
-
+ $this->d_description= strip_tags($_POST['input_desc'][$i]);
// insert into the table
- $sql="insert into document (ag_id,
d_lob,d_filename,d_mimetype,d_number) values ($1,$2,$3,$4,5)";
-
$this->db->exec_sql($sql,array($p_ag_id,$this->d_lob,$this->d_filename,$this->d_mimetype));
+ $sql="insert into document (ag_id,
d_lob,d_filename,d_mimetype,d_number,d_description) values ($1,$2,$3,$4,$5,$6)";
+
$this->db->exec_sql($sql,array($p_ag_id,$this->d_lob,$this->d_filename,$this->d_mimetype,1,$this->d_description));
}
} /* end for */
$this->db->commit();
@@ -439,7 +440,7 @@
function get_all($ag_id)
{
$res=$this->db->get_array('select d_id, ag_id, d_lob, d_number,
d_filename,'.
- ' d_mimetype from document where
ag_id=$1',array($ag_id));
+ ' d_mimetype,d_description from document
where ag_id=$1',array($ag_id));
$a=array();
for ($i=0;$i<sizeof($res); $i++ )
{
@@ -450,6 +451,7 @@
$doc->d_number=$res[$i]['d_number'];
$doc->d_filename=$res[$i]['d_filename'];
$doc->d_mimetype=$res[$i]['d_mimetype'];
+ $doc->d_description=$row['d_description'];
$a[$i]=clone $doc;
}
return $a;
@@ -469,6 +471,7 @@
$this->d_filename=$row['d_filename'];
$this->d_lob=$row['d_lob'];
$this->d_number=$row['d_number'];
+ $this->d_description=$row['d_description'];
}
/*!
@@ -1231,5 +1234,10 @@
// if ad_id is not type select get value
return $ad_value;
}
+ function update_description ($p_desc)
+ {
+ $this->db->exec_sql('update document set d_description = $1 where
d_id=$2',
+ array($p_desc,$this->d_id));
+ }
}
Modified: phpcompta/tags/rel670/include/class_follow_up.php
===================================================================
--- phpcompta/tags/rel670/include/class_follow_up.php 2013-12-06 12:01:05 UTC
(rev 5573)
+++ phpcompta/tags/rel670/include/class_follow_up.php 2013-12-06 13:38:08 UTC
(rev 5574)
@@ -379,7 +379,7 @@
$upload->name = "file_upload[]";
$upload->readOnly=$readonly;
$upload->value = "";
- $aAttachedFile = $this->db->get_array('select
d_id,d_filename,d_mimetype,' .
+ $aAttachedFile = $this->db->get_array('select
d_id,d_filename,d_description,d_mimetype,' .
'\'show_document.php?' .
Dossier::get() . '&d_id=\'||d_id as link' .
' from document where ag_id=$1',
array($this->ag_id));
Modified: phpcompta/tags/rel670/include/template/detail-action.php
===================================================================
--- phpcompta/tags/rel670/include/template/detail-action.php 2013-12-06
12:01:05 UTC (rev 5573)
+++ phpcompta/tags/rel670/include/template/detail-action.php 2013-12-06
13:38:08 UTC (rev 5574)
@@ -383,8 +383,31 @@
for ($i=0;$i<sizeof($aAttachedFile);$i++) :
?>
- <li> <A class="print" style="display:inline" id="<?php echo
"doc".$aAttachedFile[$i]['d_id'];?>" href="<?php echo
$aAttachedFile[$i]['link']?>"><?php echo $aAttachedFile[$i]['d_filename'];?>
- </A>
+ <li> <A class="print" style="display:inline" id="<?php echo
"doc".$aAttachedFile[$i]['d_id'];?>" href="<?php echo
$aAttachedFile[$i]['link']?>">
+ <?php echo $aAttachedFile[$i]['d_filename'];?> </a>
+
+
+ <br/>
+ <label>Description</label>
+ <span id="print_desc<?php echo $aAttachedFile[$i]['d_id'];?>"> <?php
echo h($aAttachedFile[$i]['d_description'])?>
+ <?php if ($p_view != 'READ') : ?>
+ <?php
+
$js=sprintf("javascript:show_description('%s')",$aAttachedFile[$i]['d_id']);
+ ?>
+ <a class="mtitle" style="color:orange" id="<?php echo
'desc'.$aAttachedFile[$i]['d_id'];?>" onclick="<?php echo $js?>">Modifier</a>
+
+ </span>
+ <span class="noprint" id="input_desc<?php echo
$aAttachedFile[$i]['d_id'];?>" style="display:none" >
+ <input type="input" class="input_text" id="input_desc_txt<?php
echo $aAttachedFile[$i]['d_id'];?>" value="<?php echo
h($aAttachedFile[$i]['d_description'])?>">
+ <?php
+
$js=sprintf("update_document('%s','%s')",dossier::id(),$aAttachedFile[$i]['d_id']);
+ echo HtmlInput::button('save_desc'.$aAttachedFile[$i]['d_id'],
'Sauve', 'onclick="'.$js.'"','smallbutton');
+ ?>
+ </span>
+ <?php else: ?>
+ </span>
+ <?php endif;?>
+ <br/>
<?php $rmDoc=sprintf("javascript:if ( confirm('"._('Voulez-vous effacer le
document')." %s')==true ) {remove_document('%s','%s');}",
$aAttachedFile[$i]['d_filename'],
dossier::id(),
@@ -402,7 +425,7 @@
try {
docAdded=document.getElementById('add_file');
new_element=document.createElement('li');
- new_element.innerHTML='<input class="inp" type="file" value=""
name="file_upload[]"/>';
+ new_element.innerHTML='<input class="inp" type="file" value=""
name="file_upload[]"/><br><label>Description</label><input type="input"
class="input_text" name="input_desc[]" >';
docAdded.appendChild(new_element);
}
catch(exception) { alert('<?php echo j(_('Je ne peux pas ajouter de
fichier'))?>'); alert(exception.message);}
@@ -415,6 +438,9 @@
<li>
<?php echo $upload->input();
?>
+ <br/>
+ <label>Description</label>
+ <input type="input" class="input_text" name="input_desc[]" >
</li>
</ol>
<span >
Modified: phpcompta/tags/rel670/sql/upgrade.sql
===================================================================
--- phpcompta/tags/rel670/sql/upgrade.sql 2013-12-06 12:01:05 UTC (rev
5573)
+++ phpcompta/tags/rel670/sql/upgrade.sql 2013-12-06 13:38:08 UTC (rev
5574)
@@ -1,17 +0,0 @@
-alter table jrn_def add jrn_def_description text;
-
-CREATE OR REPLACE FUNCTION comptaproc.t_jrn_def_description()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
- declare
- str varchar(200);
- BEGIN
- str := substr(NEW.jrn_def_description,1,200);
- NEW.jrn_def_description := str;
-
- RETURN NEW;
- END;
-$function$
-;
-create trigger jrn_def_description_ins_upd before insert or update on jrn_def
for each row execute procedure comptaproc.t_jrn_def_description();
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r5574 - in phpcompta/tags/rel670: html html/js include include/template sql,
phpcompta-dev <=