Follow-Up : comment optional
This commit is contained in:
parent
251acf11cd
commit
1f037f640e
8 changed files with 60 additions and 8 deletions
|
|
@ -193,10 +193,9 @@ if ($sub_action == "update")
|
|||
}
|
||||
$act->f_id_dest=$act->qcode_dest;
|
||||
$act->save();
|
||||
echo '<div class="content">';
|
||||
|
||||
// Add hidden tag
|
||||
echo '<form enctype="multipart/form-data" action="do.php" method="post"">';
|
||||
echo '<form enctype="multipart/form-data" style="display:inline" action="do.php" method="post"">';
|
||||
|
||||
|
||||
|
||||
|
|
@ -207,7 +206,6 @@ if ($sub_action == "update")
|
|||
echo '<input type="submit" class="button" name="save_action_st2" value="' . _('Enregistrer') . '">';
|
||||
echo $supl_hidden;
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +226,7 @@ if ($sub_action == 'detail')
|
|||
if ($g_user->can_write_action($ag_id) == true)
|
||||
{
|
||||
|
||||
echo '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php" method="post" >';
|
||||
echo '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php" method="post" style="display:inline">';
|
||||
echo $supl_hidden;
|
||||
echo HtmlInput::hidden('ac', $http->request('ac'));
|
||||
echo dossier::hidden();
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
|
|||
$this->other['detail_operation']=$http->request("detail_operation", "string", 0);
|
||||
$this->other['contact_multiple']=$http->request("det_contact_mul", "string", 0);
|
||||
$this->other['make_invoice']=$http->request("make_invoice", "string", 0);
|
||||
$this->other['followup_comment']=$http->request("followup_comment", "string", 0);
|
||||
$this->other['seq']=$http->request("seq", "string", 0);
|
||||
$this->other['select_option_operation']=$http->request("select_option_operation", "string", null);
|
||||
$this->other["cor_id"]=$http->request("cor_id","array",[]);
|
||||
|
|
@ -258,6 +259,10 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
|
|||
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
|
||||
on conflict on constraint document_option_un
|
||||
do update set do_enable=$3 ", ["make_invoice", $object_sql->dt_id, $this->other['make_invoice']]);
|
||||
// Option for comments
|
||||
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
|
||||
on conflict on constraint document_option_un
|
||||
do update set do_enable=$3 ", ["followup_comment", $object_sql->dt_id, $this->other['followup_comment']]);
|
||||
|
||||
// Option contact to save
|
||||
$cn->exec_sql("delete from jnt_document_option_contact where document_type_id=$1",[$object_sql->dt_id]);
|
||||
|
|
@ -272,6 +277,7 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,23 @@ class Document_Option
|
|||
}
|
||||
return $display_operation;
|
||||
}
|
||||
/**
|
||||
* returns true if comment are available otherwise false
|
||||
*
|
||||
* @param int $p_document_type Document_Type.dt_id
|
||||
* @return boolean
|
||||
*/
|
||||
static function is_enable_comment($p_document_type)
|
||||
{
|
||||
$display_operation=false;
|
||||
$cn=Dossier::connect();
|
||||
if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
|
||||
[$p_document_type, 'followup_comment'])=='1')
|
||||
{
|
||||
$display_operation=true;
|
||||
}
|
||||
return $display_operation;
|
||||
}
|
||||
/**
|
||||
* returns option from the operation_detail
|
||||
*
|
||||
|
|
@ -98,5 +115,19 @@ class Document_Option
|
|||
}
|
||||
return $return;
|
||||
}
|
||||
/**
|
||||
* Returns true if we can add a comment , or false if it is not possible
|
||||
* @param integer $p_id is the action_gestion.ag_id
|
||||
*/
|
||||
static function can_add_comment($p_id) {
|
||||
$cn=Dossier::connect();
|
||||
$document_type=$cn->get_value("select ag_type from action_gestion where ag_id=$1",[$p_id]);
|
||||
if (Document_Option::is_enable_comment($document_type)) return true;
|
||||
// If comment are disable, only the first one is authorized as event description
|
||||
$cnt=$cn->get_value("select count(*) from action_gestion_comment where ag_id=$1",[$p_id]);
|
||||
if ($cnt == 0 ) return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ require_once NOALYSS_INCLUDE.'/lib/inum.class.php';
|
|||
require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/irelated_action.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/tag.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/document_option.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/default_menu.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/inplace_edit.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
|
||||
|
|
@ -592,7 +593,7 @@ class Follow_Up
|
|||
/* Upload the documents */
|
||||
$doc=new Document($this->db);
|
||||
$doc->Upload($this->ag_id);
|
||||
if (trim($this->ag_comment)!='')
|
||||
if (trim($this->ag_comment)!='' && Document_Option::can_add_comment($this->ag_id))
|
||||
{
|
||||
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment) values ($1,$2,$3)"
|
||||
, array($this->ag_id, $_SESSION['g_user'], $this->ag_comment));
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
|
|||
if ( ! defined ("SYSINFO_DISPLAY")) {
|
||||
define ("SYSINFO_DISPLAY",TRUE);
|
||||
}
|
||||
define ("DBVERSION",148);
|
||||
define ("DBVERSION",149);
|
||||
define ("MONO_DATABASE",25);
|
||||
define ("DBVERSIONREPO",18);
|
||||
define ('NOTFOUND','--not found--');
|
||||
|
|
|
|||
6
include/sql/patch/upgrade148.sql
Normal file
6
include/sql/patch/upgrade148.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
begin;
|
||||
INSERT INTO public.document_option (do_code, document_type_id, do_enable, do_option) select 'followup_comment', dt_id, 1, NULL
|
||||
from document_type ;
|
||||
|
||||
insert into version (val,v_description) values (149,'Default values for document_option,comment on followup');
|
||||
commit;
|
||||
|
|
@ -92,6 +92,14 @@ $i=new ICheckBox("make_invoice",1);
|
|||
if ( Document_Option::is_enable_make_invoice($table->dt_id)) $i->set_check(1); else $i->set_check(0);
|
||||
echo $i->input();
|
||||
echo _("Création de facture");
|
||||
?>
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
$i=new ICheckBox("followup_comment",1);
|
||||
if ( Document_Option::is_enable_comment($table->dt_id)) $i->set_check(1); else $i->set_check(0);
|
||||
echo $i->input();
|
||||
echo _("Commentaire");
|
||||
?>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -276,10 +276,12 @@ for( $c=0;$c<count($acomment);$c++){
|
|||
echo $comment;
|
||||
}
|
||||
echo '<span class="noprint">';
|
||||
echo $desc->input();
|
||||
if ( Document_Option::can_add_comment($ag_id) ) {
|
||||
echo $desc->input();
|
||||
}
|
||||
echo '</span>';
|
||||
?>
|
||||
<?php if ($p_view != "READ" ): ?>
|
||||
<?php if ($p_view != "READ" && Document_Option::can_add_comment($ag_id)): ?>
|
||||
<p class="noprint">
|
||||
<input type="button" id="bt_enlarge" <?php echo $style_enl?> value="+" onclick="enlarge('ag_comment');return false;">
|
||||
<input type="button" id="bt_small" <?php echo $style_small?> value="-" style="display:none" onclick="small('ag_comment');return false;">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue