mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Debug v20
This commit is contained in:
parent
566a0ad3f6
commit
68c81e5311
|
|
@ -11,7 +11,6 @@ AiDescription
|
|||
AiDescriptionLong
|
||||
AiSetup
|
||||
AI_API_CHATGPT_ENDPOINT
|
||||
AI_API_CHATGPT_KEY
|
||||
|
||||
# datapolicy
|
||||
DATAPOLICY_ADHERENT
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ fi
|
|||
|
||||
# Produce reports on STDOUT.
|
||||
# Some output is already compatible with message extraction for github annotation (logToCs.py)
|
||||
# # Produce reports on STDOUT.
|
||||
# Some output is already compatible with message extraction for github annotation (logToCs.py)
|
||||
#
|
||||
diff "${AVAILABLE_FILE}" "${EXPECTED_FILE}" \
|
||||
| grep -E "^[<>]" \
|
||||
|
|
|
|||
|
|
@ -64,15 +64,16 @@ if (!class_exists('FormSetup')) {
|
|||
$formSetup = new FormSetup($db);
|
||||
|
||||
// List all available IA
|
||||
$arrayofia = array('chatgpt');
|
||||
$arrayofia = array('chatgpt' => 'ChatGPT', 'grok' => 'Grok', 'gemini' => 'Gemini');
|
||||
|
||||
foreach ($arrayofia as $ia) {
|
||||
foreach ($arrayofia as $ia => $ialabel) {
|
||||
// Setup conf AI_PUBLIC_INTERFACE_TOPIC
|
||||
/*$item = $formSetup->newItem('AI_API_'.strtoupper($ia).'_ENDPOINT'); // Name of constant must end with _KEY so it is encrypted when saved into database.
|
||||
$item->defaultFieldValue = '';
|
||||
$item->cssClass = 'minwidth500';*/
|
||||
|
||||
$item = $formSetup->newItem('AI_API_'.strtoupper($ia).'_KEY'); // Name of constant must end with _KEY so it is encrypted when saved into database.
|
||||
$item->nameText = $langs->trans("AI_API_KEY").' ('.$ialabel.')';
|
||||
$item->defaultFieldValue = '';
|
||||
$item->cssClass = 'minwidth500';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -855,57 +855,21 @@ if ($action == 'create') {
|
|||
$formmail->withaiprompt = 'html';
|
||||
$formmail->withlayout = 1;
|
||||
|
||||
print '<tr class="fieldsforemail"><td></td><td>';
|
||||
print '<tr class="fieldsforemail"><td></td><td class="tdtop">';
|
||||
|
||||
$out = '';
|
||||
// Add link to add layout
|
||||
if ($formmail->withlayout && $formmail->withfckeditor) {
|
||||
$out .= '<a href="#" id="linkforlayouttemplates" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithALayout"), 'layout', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillMessageWithALayout").'...';
|
||||
$out .= '</a> ';
|
||||
$showlinktolayout = $formmail->withlayout && $formmail->withfckeditor;
|
||||
$showlinktolayoutlabel = $langs->trans("FillMessageWithALayout");
|
||||
$showlinktoai = $formmail->withaiprompt && isModEnabled('ai');
|
||||
$showlinktoailabel = $langs->trans("FillMessageWithAIContent");
|
||||
$formatforouput = 'html';
|
||||
$htmlname = 'bodyemail';
|
||||
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforlayouttemplates").click(function() {
|
||||
console.log("We click on linkforlayouttemplates");
|
||||
event.preventDefault();
|
||||
jQuery("#template-selector").toggle();
|
||||
//jQuery("#template-selector").attr("style", "aaa");
|
||||
jQuery("#ai_input").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
// Fill $out
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php';
|
||||
|
||||
// Add link to add AI content
|
||||
if ($formmail->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= '<a href="#" id="linkforaiprompt" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithAIContent"), 'ai', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillMessageWithAIContent").'...';
|
||||
$out .= '</a>';
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforaiprompt").click(function() {
|
||||
console.log("We click on linkforaiprompt");
|
||||
event.preventDefault();
|
||||
jQuery("#ai_input").toggle();
|
||||
jQuery("#template-selector").hide();
|
||||
if (!jQuery("ai_input").is(":hidden")) {
|
||||
console.log("Set focus on input field");
|
||||
jQuery("#ai_instructions").focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
if ($formmail->withfckeditor) {
|
||||
$out .= $formmail->getModelEmailTemplate('bodyemail');
|
||||
}
|
||||
if ($formmail->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= $formmail->getSectionForAIPrompt('', 'bodyemail');
|
||||
}
|
||||
print $out;
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
|
|
|||
|
|
@ -762,10 +762,10 @@ class Mailing extends CommonObject
|
|||
}
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->title)) {
|
||||
$datas['title'] .= '<br><b>'.$langs->trans('MailTitle').':</b> '.$this->title;
|
||||
$datas['title'] = '<br><b>'.$langs->trans('MailTitle').':</b> '.$this->title;
|
||||
}
|
||||
if (isset($this->sujet)) {
|
||||
$datas['subject'] .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->sujet;
|
||||
$datas['subject'] = '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->sujet;
|
||||
}
|
||||
|
||||
return $datas;
|
||||
|
|
|
|||
|
|
@ -1005,57 +1005,19 @@ class FormMail extends Form
|
|||
$out .= '<td class="tdtop">';
|
||||
$out .= $form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
$out .= '<td class="tdtop">';
|
||||
|
||||
// Add link to add layout
|
||||
if ($this->withlayout && $this->withfckeditor) {
|
||||
$out .= '<a href="#" id="linkforlayouttemplates" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithALayout"), 'layout', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillMessageWithALayout").'...';
|
||||
$out .= '</a> ';
|
||||
$formmail = $this;
|
||||
$showlinktolayout = $formmail->withlayout && $formmail->withfckeditor;
|
||||
$showlinktolayoutlabel = $langs->trans("FillMessageWithALayout");
|
||||
$showlinktoai = $formmail->withaiprompt && isModEnabled('ai');
|
||||
$showlinktoailabel = $langs->trans("FillMessageWithAIContent");
|
||||
$formatforouput = '';
|
||||
$htmlname = 'message';
|
||||
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforlayouttemplates").click(function() {
|
||||
console.log("We click on linkforlayouttemplates");
|
||||
event.preventDefault();
|
||||
jQuery("#template-selector").toggle();
|
||||
//jQuery("#template-selector").attr("style", "aaa");
|
||||
jQuery("#ai_input").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
// Add link to add AI content
|
||||
if ($this->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= '<a href="#" id="linkforaiprompt" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithAIContent"), 'ai', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillMessageWithAIContent").'...';
|
||||
$out .= '</a>';
|
||||
// Fill $out
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php';
|
||||
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforaiprompt").click(function() {
|
||||
console.log("We click on linkforaiprompt");
|
||||
event.preventDefault();
|
||||
jQuery("#ai_input").toggle();
|
||||
jQuery("#template-selector").hide();
|
||||
if (!jQuery("ai_input").is(":hidden")) {
|
||||
console.log("Set focus on input field");
|
||||
jQuery("#ai_instructions").focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
if ($this->withfckeditor) {
|
||||
$out .= $this->getModelEmailTemplate();
|
||||
}
|
||||
if ($this->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= $this->getSectionForAIPrompt($this->withaiprompt);
|
||||
}
|
||||
$out .= '</td>';
|
||||
$out .= '</tr>';
|
||||
|
||||
|
|
|
|||
97
htdocs/core/tpl/formlayoutai.tpl.php
Normal file
97
htdocs/core/tpl/formlayoutai.tpl.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Need to have following variables defined:
|
||||
* $conf
|
||||
* $formmail
|
||||
* $formwebsite (optional)
|
||||
* $showlinktolayout
|
||||
* $showlinktolayoutlabel
|
||||
* $showlinktoai
|
||||
* $showlinktoailabel
|
||||
* $htmlname
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE formlayoutai.tpl.php -->
|
||||
<?php
|
||||
|
||||
// Add link to add layout
|
||||
if ($showlinktolayout) {
|
||||
$out .= '<a href="#" id="linkforlayouttemplates" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($showlinktolayoutlabel, 'layout', 'class="paddingrightonly"');
|
||||
$out .= $showlinktolayoutlabel.'...';
|
||||
$out .= '</a> ';
|
||||
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforlayouttemplates").click(function() {
|
||||
console.log("We click on linkforlayouttemplates");
|
||||
event.preventDefault();
|
||||
jQuery("#template-selector").toggle();
|
||||
//jQuery("#template-selector").attr("style", "aaa");
|
||||
jQuery("#ai_input").hide();
|
||||
jQuery("#pageContent").show(); // May exists for website page only
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
// Add link to add AI content
|
||||
if ($showlinktoai) {
|
||||
$out .= '<a href="#" id="linkforaiprompt" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($showlinktoailabel, 'ai', 'class="paddingrightonly"');
|
||||
$out .= $showlinktoailabel.'...';
|
||||
$out .= '</a>';
|
||||
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforaiprompt").click(function() {
|
||||
console.log("We click on linkforaiprompt");
|
||||
event.preventDefault();
|
||||
jQuery("#ai_input").toggle();
|
||||
jQuery("#template-selector").hide();
|
||||
if (!jQuery("ai_input").is(":hidden")) {
|
||||
console.log("Set focus on input field");
|
||||
jQuery("#ai_instructions").focus();
|
||||
if (!jQuery("pageContent").is(":hidden")) { // May exists for website page only
|
||||
jQuery("#pageContent").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
if ($showlinktolayout) {
|
||||
if (!empty($formwebsite) && is_object($formwebsite)) {
|
||||
$out .= $formwebsite->getContentPageTemplate($htmlname);
|
||||
} else {
|
||||
$out .= $formmail->getModelEmailTemplate($htmlname);
|
||||
}
|
||||
}
|
||||
if ($showlinktoai) {
|
||||
$out .= $formmail->getSectionForAIPrompt($formmail->withaiprompt, $htmlname);
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- END PHP TEMPLATE commonfields_edit.tpl.php -->
|
||||
|
|
@ -2247,7 +2247,7 @@ NotAPublicIp=Not a public IP
|
|||
MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server (done 1 time only after installation) to allow the foundation to count the number of Dolibarr installation.
|
||||
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
|
||||
EmailTemplate=Template for email
|
||||
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
|
||||
EMailsWillHaveMessageID=Emails will have a 'Message-ID' header matching this syntax
|
||||
PDF_SHOW_PROJECT=Show project on document
|
||||
ShowProjectLabel=Project Label
|
||||
PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME=Include alias in third-party name
|
||||
|
|
@ -2450,8 +2450,8 @@ ExportUseForceHelp=Force to continue the export even when an error is found (Bac
|
|||
CustomPrompt=Custom prompts
|
||||
AiDescription=AI (Artificial Intelligence) features
|
||||
AiDescriptionLong=Provides AI (Artificial Intelligence) features in different parts of the application. Need external AI API.
|
||||
AI_API_CHATGPT_ENDPOINT=Endpoint for ChatGPT AI api
|
||||
AI_API_CHATGPT_KEY=Key for ChatGPT AI api
|
||||
AI_API_KEY=Key for AI api
|
||||
AI_API_CHATGPT_ENDPOINT=Endpoint for AI api
|
||||
AiSetup=AI module setup
|
||||
AiCustomPrompt=AI custom prompt
|
||||
AI_CONFIGURATIONS_PROMPT=Custom prompt
|
||||
|
|
|
|||
|
|
@ -4303,62 +4303,23 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
if ($action == 'createcontainer') {
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withaiprompt = 'html';
|
||||
$formmail->withlayout = 1;
|
||||
|
||||
print '<tr><td class="titlefield fieldrequired tdtop">';
|
||||
print $langs->trans('WEBSITE_PAGE_EXAMPLE');
|
||||
//print $langs->trans('WEBSITE_PAGE_EXAMPLE');
|
||||
print '</td><td class="tdtop">';
|
||||
|
||||
$out = '';
|
||||
// Add link to add a predefined layout
|
||||
$out .= '<a href="#" id="linkforlayouttemplates" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithALayout"), 'layout', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillPageWithALayout").'...';
|
||||
$out .= '</a> ';
|
||||
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforlayouttemplates").click(function() {
|
||||
console.log("We click on linkforlayouttemplates");
|
||||
event.preventDefault();
|
||||
jQuery("#template-selector").toggle();
|
||||
//jQuery("#template-selector").attr("style", "aaa");
|
||||
jQuery("#ai_input").hide();
|
||||
jQuery("#pageContent").show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
$showlinktolayout = $formmail->withlayout;
|
||||
$showlinktolayoutlabel = $langs->trans("FillPageWithALayout");
|
||||
$showlinktoai = $formmail->withaiprompt && isModEnabled('ai');
|
||||
$showlinktoailabel = $langs->trans("FillPageWithAIContent");
|
||||
$htmlname = 'content';
|
||||
|
||||
// Add link to add AI content
|
||||
if ($formmail->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= '<a href="#" id="linkforaiprompt" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithAIContent"), 'ai', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillPageWithAIContent").'...';
|
||||
$out .= '</a>';
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
$("#linkforaiprompt").click(function() {
|
||||
console.log("We click on linkforaiprompt");
|
||||
event.preventDefault();
|
||||
jQuery("#ai_input").toggle();
|
||||
jQuery("#template-selector").hide();
|
||||
if (!jQuery("ai_input").is(":hidden")) {
|
||||
console.log("Set focus on input field");
|
||||
jQuery("#ai_instructions").focus();
|
||||
if (!jQuery("pageContent").is(":hidden")) {
|
||||
jQuery("#pageContent").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
// Fill $out
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php';
|
||||
|
||||
$out .= $formwebsite->getContentPageTemplate('content');
|
||||
|
||||
if ($formmail->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= $formmail->getSectionForAIPrompt('', 'content');
|
||||
}
|
||||
print $out;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user