diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php
index 0a4b68d65..b6b4f7b99 100644
--- a/include/class/action_document_type_mtable.class.php
+++ b/include/class/action_document_type_mtable.class.php
@@ -78,6 +78,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['make_feenote']=$http->request("make_feenote", "string", 0);
$this->other['followup_comment']=$http->request("followup_comment", "string", 0);
$this->other['editable_description']=$http->request("editable_description", "string", 0);
$this->other['enable_followup']=$http->request("enable_followup", "string", 0);
@@ -272,6 +273,12 @@ 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']]);
+
+ // Save make feenote
+ $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_feenote", $object_sql->dt_id, $this->other['make_feenote']]);
+
// Option for comments
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4)
on conflict on constraint document_option_un
diff --git a/include/class/default_menu.class.php b/include/class/default_menu.class.php
index 460eb79a2..cc8dc685a 100644
--- a/include/class/default_menu.class.php
+++ b/include/class/default_menu.class.php
@@ -49,15 +49,24 @@ class Default_Menu
$idx = $tmenu->getp('md_code');
$this->a_menu_def[$idx] = $tmenu->getp('me_code');
}
- $this->code = explode(',', 'code_follow,code_invoice');
+ $this->code = explode(',', 'code_follow,code_invoice,code_feenote',);
}
function input_value()
{
$code_invoice = new IText('code_invoice', $this->a_menu_def['code_invoice']);
$code_follow = new IText('code_follow', $this->a_menu_def['code_follow']);
- echo '
' . _('Code pour création facture depuis gestion') . $code_invoice->input() . '
';
- echo '' . _('Code pour appel gestion') . $code_follow->input() . '
';
+ $code_feenote = new IText('code_feenote', $this->a_menu_def['code_feenote']);
+ echo '';
}
private function check_code($p_string)
diff --git a/include/class/document_option.class.php b/include/class/document_option.class.php
index 9716de352..cf00f2aa5 100644
--- a/include/class/document_option.class.php
+++ b/include/class/document_option.class.php
@@ -117,6 +117,23 @@ class Document_Option
}
return $return;
}
+ /**
+ * returns true if the operation_detail is enable, otherwise false
+ *
+ * @param int $p_document_type Document_Type.dt_id
+ * @return boolean
+ */
+ static function is_enable_make_feenote($p_document_type)
+ {
+ $return=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, 'make_feenote'])=='1')
+ {
+ $return=true;
+ }
+ 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
diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php
index 59768647d..73677f8ef 100644
--- a/include/compta_ach.inc.php
+++ b/include/compta_ach.inc.php
@@ -239,6 +239,20 @@ try
echo 'compute_all_ledger();';
echo '';
}
+ else if (isset($_GET['create_feenote']))
+ {
+ $array=$Ledger->convert_from_follow($http->get('ag_id',"number"));
+ echo HtmlInput::hidden("ledger_type", "VEN");
+ echo HtmlInput::hidden("ac",$http->get('ac'));
+ echo HtmlInput::hidden("sa", "p");
+ echo $Ledger->input($array);
+ echo '';
+ echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
+ echo '
';
+ echo '';
+ }
else
{
echo $Ledger->input($array);
diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php
index 954f8bea4..abcce1167 100644
--- a/include/compta_ven.inc.php
+++ b/include/compta_ven.inc.php
@@ -255,9 +255,9 @@ try
}
else if (isset($_GET['create_invoice']))
{
- $array=$Ledger->convert_from_follow($_GET ['ag_id']);
+ $array=$Ledger->convert_from_follow($http->get('ag_id',"number"));
echo HtmlInput::hidden("ledger_type", "VEN");
- echo HtmlInput::hidden("ac", $_REQUEST['ac']);
+ echo HtmlInput::hidden("ac", $http->get('ac'));
echo HtmlInput::hidden("sa", "p");
echo $Ledger->input($array);
echo '';
diff --git a/include/sql/patch/upgrade180.sql b/include/sql/patch/upgrade180.sql
new file mode 100644
index 000000000..0ba2b9712
--- /dev/null
+++ b/include/sql/patch/upgrade180.sql
@@ -0,0 +1,5 @@
+begin;
+insert into menu_default (md_code,me_code)values ('code_feenote','COMPTA/MENUACH/ACH');
+
+insert into version (val,v_description) values (181,'Make feenote from Management');
+commit;
diff --git a/include/template/action_document_type_mtable_input.php b/include/template/action_document_type_mtable_input.php
index 16924b848..f988b90a1 100644
--- a/include/template/action_document_type_mtable_input.php
+++ b/include/template/action_document_type_mtable_input.php
@@ -94,7 +94,15 @@ echo $i->input();
echo _("Création de facture");
?>
-
+
+dt_id)) $i->set_check(1); else $i->set_check(0);
+echo $i->input();
+echo _("Création de note de frais ou facture Achat");
+?>
+
+
-
+
+
+
dt_id)):
?>
-
+
Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_invoice'=>1, 'ac'=>$menu->get('code_invoice')));
- echo HtmlInput::button_anchor(_("Transformer en facture"), "do.php?".$query, "create_invoice",
+ echo HtmlInput::button_anchor(_("Transformer en Facture de Vente"), "do.php?".$query, "create_invoice",
' target="_blank" ', "button");
?>
-
+
\ No newline at end of file
+ ?>
+
+ dt_id)):
+ ?>
+
+ Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_feenote'=>1, 'ac'=>$menu->get('code_feenote')));
+ echo HtmlInput::button_anchor(_("Transformer en Note de frais ou Facture Achat"), "do.php?".$query, "create_feenote",
+ ' target="_blank" ', "button");
+ ?>
+
+
+