Merge branch 'develop' into fix_element_type_part_05

This commit is contained in:
Laurent Destailleur 2024-03-12 14:22:25 +01:00 committed by GitHub
commit 53c3406d11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
119 changed files with 538 additions and 647 deletions

View file

@ -114,7 +114,7 @@ jobs:
curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}"
shell: powershell
- name: Run PHPUnit tests
continue-on-error: true
# continue-on-error: true
shell: cmd
# setting up php.ini, starting the php server are currently in this step
run: |-
@ -143,7 +143,7 @@ jobs:
cat htdocs/conf/conf.php
curl "http://${{ env.PHPSERVER_DOMAIN_PORT }}"
REM 'DOSKEY' USED to recover error code (no pipefile equivalent in windows?)
( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}"
( php "%PHPROOT%\phpunit" -d memory_limit=-1 -c %CD%\test\phpunit\phpunittest.xml "test\phpunit\AllTests.php" --exclude-group WindowsWaitingForFix & call doskey /exename=err err=%%^^errorlevel%% ) | "${{ env.TEE }}" "${{ env.PHPUNIT_LOG }}"
for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2024.2.9

View file

@ -4,7 +4,7 @@
#
# shellcheck disable=1113,2002,2006,2086,2164,2219
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "develop")
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "develop")
let "counter = 0"
echo "Copy script into /tmp/github_commits_byversion.sh"
@ -49,4 +49,3 @@ do
echo
let "counter +=1"
done

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
define('DOL_PROJECT_ROOT', __DIR__.'/../../..');
define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs');
@ -475,7 +476,7 @@ return [
// 'PhanPluginUnknownFunctionReturnType',
// 'PhanPluginDescriptionlessCommentOnProtectedProperty',
'PhanPluginRedundantAssignmentInGlobalScope',
'PhanTypeMismatchDeclaredParamNullable',
// 'PhanTypeMismatchDeclaredParamNullable',
'PhanTypeInvalidRightOperandOfAdd',
// 'PhanPluginDescriptionlessCommentOnPrivateProperty',
// 'PhanUndeclaredVariableDim', // Array initialisation on undeclared var: $abc['x']='ab'
@ -493,7 +494,7 @@ return [
'PhanRedefineClass',
'PhanRedefineFunction',
'PhanTypeInvalidLeftOperandOfBitwiseOp',
'PhanTypeMismatchDimAssignment',
// 'PhanTypeMismatchDimAssignment',
// 'PhanPluginDescriptionlessCommentOnProtectedMethod',
'PhanPluginPrintfIncompatibleArgumentTypeWeak',
'PhanUndeclaredVariableAssignOp',
@ -535,7 +536,8 @@ return [
// 'PhanTypeInvalidThrowsIsInterface',
// 'PhanPluginRedundantAssignmentInLoop',
// 'PhanInvalidCommentForDeclarationType',
//'PhanParamSignatureMismatchInternal',
// 'PhanParamSignatureMismatchInternal',
// 'PhanParamSignatureMismatch',
// 'PhanPluginEmptyStatementForeachLoop',
// 'PhanCompatibleDimAlternativeSyntax',
'PhanInvalidFQSENInClasslike',
@ -656,5 +658,4 @@ return [
'sockets' => PHAN_DIR . '/stubs/sockets.phan_php',
'zip' => PHAN_DIR . '/stubs/zip.phan_php',
],
];

View file

@ -1,4 +1,7 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
// Uncomment require_once to enable corresponding fixer
@ -7,8 +10,6 @@
//require_once __DIR__.'/plugins/UrlEncodeStringifyFixer.php';
require_once __DIR__.'/plugins/SelectDateFixer.php';
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
define('DOL_PROJECT_ROOT', __DIR__.'/../../..');
define('DOL_DOCUMENT_ROOT', DOL_PROJECT_ROOT.'/htdocs');
define('PHAN_DIR', __DIR__);

View file

@ -490,7 +490,7 @@ class Adherent extends CommonObject
*/
public function makeSubstitution($text)
{
global $conf, $langs;
global $langs;
$birthday = dol_print_date($this->birth, 'day');

View file

@ -273,9 +273,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".dkim").hide();
jQuery(".dkim").hide();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
@ -302,9 +302,9 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".smtp_method").show();
jQuery(".dkim").show();
jQuery(".smtp_auth_method").show();
jQuery(".smtp_auth_method").show();
}
}
function change_smtp_auth_method() {
@ -1109,7 +1109,7 @@ if ($action == 'edit') {
$formmail->withtopicreadonly = 0;
$formmail->withfile = 2;
$formmail->withlayout = 1;
$formmail->withaiprompt = 1;
$formmail->withaiprompt = ($action == 'testhtml' ? 'html' : 'text');
$formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
$formmail->withbodyreadonly = 0;
$formmail->withcancel = 1;

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -167,7 +168,10 @@ foreach ($modulesdir as $dir) {
$familyinfo = array_merge($familyinfo, $objMod->familyinfo);
$familykey = key($objMod->familyinfo);
} else {
$familykey = empty($objMod->family) ? 'other' : $objMod->family;
$familykey = $objMod->family;
}
if (empty($familykey) || $familykey === null) {
$familykey = 'other';
}
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');

View file

@ -61,13 +61,20 @@ if (is_null($jsonData)) {
}
$ai = new Ai($db);
$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8');
$function = 'textgeneration';
$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8');
$format = empty($jsonData['instructions']) ? '' : $jsonData['instructions'];
$generatedContent = $ai->generateContent($instructions, 'auto', $function);
$generatedContent = $ai->generateContent($instructions, 'auto', $function, $format);
if (is_array($generatedContent) && $generatedContent['error']) {
print "Error : " . $generatedContent['message'];
// client errors
if ($generatedContent['code'] >= 400) {
print "Error : " . $generatedContent['message'];
print '<br><a href="'.DOL_MAIN_URL_ROOT.'/ai/admin/setup.php">'.$langs->trans('Check Config of Module').'</a>';
} else {
print "Error returned by API call: " . $generatedContent['message'];
}
} else {
print $generatedContent;
}

View file

@ -1,9 +1,5 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.fr>
/* 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
@ -20,13 +16,14 @@
* or see https://www.gnu.org/
*/
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
/**
* Class for AI
*/
class Ai
{
/**
* @var DoliDB $db Database object
*/
@ -57,13 +54,18 @@ class Ai
/**
* Generate response of instructions
*
* @param string $instructions instruction for generate content
* @param string $model model name ('gpt-3.5-turbo')
* @param string $function code of the feature we want to use ('emailing', 'transcription', 'audiotext', 'imagegeneration', 'translation')
* @param string $instructions Instruction to generate content
* @param string $model Model name ('gpt-3.5-turbo', 'gpt-4-turbo', 'dall-e-3', ...)
* @param string $function Code of the feature we want to use ('textgeneration', 'transcription', 'audiotext', 'imagegeneration', 'translation')
* @param string $format Format for output ('', 'html', ...)
* @return mixed $response
*/
public function generateContent($instructions, $model = 'auto', $function = 'textgeneration')
public function generateContent($instructions, $model = 'auto', $function = 'textgeneration', $format = '')
{
if (empty($this->apiKey)) {
return array('error' => true, 'message' => 'API key is no defined');
}
if (empty($this->apiEndpoint)) {
if ($function == 'textgeneration') {
$this->apiEndpoint = 'https://api.openai.com/v1/chat/completions';
@ -97,6 +99,8 @@ class Ai
}
}
dol_syslog("Call API for apiEndpoint=".$this->apiEndpoint." apiKey=".substr($this->apiKey, 0, 3).'***********, model='.$model);
try {
$configurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT');
$configurations = json_decode($configurationsJson, true);
@ -115,40 +119,37 @@ class Ai
}
$fullInstructions = $prePrompt.' '.$instructions.' .'.$postPrompt;
// TODO Replace this with a simple call of getDolURLContent();
$ch = curl_init($this->apiEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
$payload = json_encode([
'messages' => [
['role' => 'user', 'content' => $fullInstructions]
],
'model' => $model
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
]);
$headers = ([
'Authorization: Bearer ' . $this->apiKey,
'Content-Type: application/json'
]);
$response = getURLContent($this->apiEndpoint, 'POST', $payload, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
throw new Exception('cURL error: ' . curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($statusCode != 200) {
throw new Exception('API request failed with status code ' . $statusCode);
if ($response['http_code'] != 200) {
throw new Exception('API request failed with status code ' . $response['http_code']);
}
// Decode JSON response
$decodedResponse = json_decode($response, true);
$decodedResponse = json_decode($response['content'], true);
// Extraction content
$generatedEmailContent = $decodedResponse['choices'][0]['message']['content'];
// If content is not HTML, we convert it into HTML
if (!dol_textishtml($generatedEmailContent)) {
$generatedEmailContent = dol_nl2br($generatedEmailContent);
}
return $generatedEmailContent;
} catch (Exception $e) {
return array('error' => true, 'message' => $e->getMessage());
} finally {
curl_close($ch);
}
}
}

View file

@ -845,6 +845,63 @@ if ($action == 'create') {
print $htmlother->selectColor(GETPOST('bgcolor'), 'bgcolor', '', 0);
print '</td></tr>';
$formmail = new FormMail($db);
$formmail->withfckeditor = 1;
$formmail->withaiprompt = 'html';
$formmail->withlayout = 1;
print '<tr class="fieldsforemail"><td></td><td>';
$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> &nbsp; &nbsp; ';
$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 ($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();
}
if ($formmail->withaiprompt && isModEnabled('ai')) {
$out .= $formmail->getSectionForAIPrompt();
}
print $out;
print '</td></tr>';
print '</table>';
print '<div style="padding-top: 10px">';
@ -1195,7 +1252,7 @@ if ($action == 'create') {
$formmail->withtopicreadonly = 1;
$formmail->withfile = 0;
$formmail->withlayout = 0;
$formmail->withaiprompt = 0;
$formmail->withaiprompt = '';
$formmail->withbody = 0;
$formmail->withbodyreadonly = 1;
$formmail->withcancel = 1;

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -45,6 +45,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
// Security check
$socid = GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('socid');
/** @var User $user */
if ($user->socid > 0) {
$socid = $user->socid;
}
@ -55,7 +56,7 @@ if ($user->socid > 0) {
}
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
$permissiontocreate = ($user->rights->societe->creer || $user->rights->facture->creer);
$permissiontocreate = ($user->hasRight('societe', 'creer') || $user->hasRight('facture', 'creer'));

View file

@ -132,7 +132,7 @@ abstract class CommonNumRefGenerator
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

View file

@ -3280,8 +3280,8 @@ abstract class CommonObject
if ($this->db->num_rows($resql) > 0) {
while ($row = $this->db->fetch_row($resql)) {
$rows[] = $row[0];
if (!empty($includealltree)) {
$rows = array_merge($rows, $this->getChildrenOfLine($row[0]), $includealltree);
if ($includealltree) {
$rows = array_merge($rows, $this->getChildrenOfLine($row[0], $includealltree));
}
}
}
@ -7928,7 +7928,11 @@ abstract class CommonObject
if (!empty($value)) {
$checked = ' checked ';
}
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
} else {
$value = yn($value ? 1 : 0);
}
} elseif ($type == 'mail' || $type == 'email') {
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
} elseif ($type == 'url') {

View file

@ -41,9 +41,14 @@ class Conf extends stdClass
*/
public $db;
//! To store properties found into database
/**
* @var Object To store global setup found into database
*/
public $global;
//! To store browser info (->name, ->os, ->version, ->ua, ->layout, ...)
/**
* @var Object To store browser info (->name, ->os, ->version, ->ua, ->layout, ...)
*/
public $browser;
//! To store some setup of generic modules

View file

@ -1121,7 +1121,6 @@ class ExtraFields
} else {
$checked = ' value="1" ';
}
$out = '<input type="checkbox" class="flat valignmiddle'.($morecss ? ' '.$morecss : '').' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';
} else {
$out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
@ -1691,7 +1690,11 @@ class ExtraFields
if (!empty($value)) {
$checked = ' checked ';
}
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
} else {
$value = yn($value ? 1 : 0);
}
} elseif ($type == 'mail') {
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
} elseif ($type == 'ip') {

View file

@ -9681,8 +9681,8 @@ class Form
$stringforfirstkey .= ' CTL +';
}
$previous_ref = $object->ref_previous ? '<a accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
$next_ref = $object->ref_next ? '<a accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
}
//print "xx".$previous_ref."x".$next_ref;
@ -9696,8 +9696,8 @@ class Form
if ($previous_ref || $next_ref || $morehtml) {
$ret .= '<div class="pagination paginationref"><ul class="right">';
}
if ($morehtml) {
$ret .= '<li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
}
if ($shownav && ($previous_ref || $next_ref)) {
$ret .= '<li class="pagination">' . $previous_ref . '</li>';

View file

@ -142,12 +142,12 @@ class FormMail extends Form
public $withfile;
/**
* @var int 1=Add a button "Fill with layout"
* @var int 1=Add a button "Fill with layout"
*/
public $withlayout;
/**
* @var int 1=Add a button "Fill with AI generation"
* @var string 'text' or 'html' to add a button "Fill with AI generation"
*/
public $withaiprompt;
@ -1051,7 +1051,7 @@ class FormMail extends Form
$out .= $this->getModelEmailTemplate();
}
if ($this->withaiprompt && isModEnabled('ai')) {
$out .= $this->getSectionForAIPrompt();
$out .= $this->getSectionForAIPrompt($this->withaiprompt);
}
$out .= '</td>';
$out .= '</tr>';
@ -1399,7 +1399,7 @@ class FormMail extends Form
}
/**
* get Html For Topic of message
* Return Html section for the Topic of message
*
* @param array $arraydefaultmessage Array with message template content
* @param string $helpforsubstitution Help string for substitution
@ -1437,11 +1437,12 @@ class FormMail extends Form
}
/**
* Return Html code for AI instruction of message
* Return Html code for AI instruction of message and autofill result
*
* @return string Text for instructions
* @param string $format Format for output ('', 'html', ...)
* @return string HTML code to ask AI instruction and autofill result
*/
public function getSectionForAIPrompt()
public function getSectionForAIPrompt($format = '')
{
global $langs;
@ -1455,7 +1456,6 @@ class FormMail extends Form
$out .= '<input id="generate_button" type="button" class="button smallpaddingimp" value="'.$langs->trans('Generate').'"/>';
$out .= "</td></tr>\n";
$out .= "<script type='text/javascript'>
$(document).ready(function() {
// for keydown
@ -1468,16 +1468,18 @@ class FormMail extends Form
$('#generate_button').click(function() {
var instructions = $('#ai_instructions').val();
//editor on readonly
if (CKEDITOR.instances.message) {
CKEDITOR.instances.message.setReadOnly(1);
}
$.ajax({
url: '". DOL_URL_ROOT."/ai/ajax/generate_content.php?token=".newToken()."',
url: '". DOL_URL_ROOT."/ai/ajax/generate_content.php?token=".currentToken()."',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
'format': '".dol_escape_js($format)."',
'instructions': instructions,
}),
success: function(response) {
@ -1810,7 +1812,7 @@ class FormMail extends Form
*/
public function setSubstitFromObject($object, $outputlangs)
{
global $conf, $user, $extrafields;
global $extrafields;
$parameters = array();
$tmparray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
@ -1867,7 +1869,7 @@ class FormMail extends Form
*/
public static function getAvailableSubstitKey($mode = 'formemail', $object = null)
{
global $conf, $langs;
global $langs;
$tmparray = array();
if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines') {

View file

@ -381,10 +381,11 @@ abstract class DoliDB implements Database
{
$sql .= ' LIMIT 1';
$res = $this->query($sql);
if ($res) {
$obj = $this->fetch_object($res);
$resql = $this->query($sql);
if ($resql) {
$obj = $this->fetch_object($resql);
if ($obj) {
$this->free($resql);
return $obj;
} else {
return 0;
@ -395,24 +396,28 @@ abstract class DoliDB implements Database
}
/**
* Return all results from query as an array of objects
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
* be careful with this method use it only with some limit of results to avoid performances loss.
* Return all results from query as an array of objects. Using this is a bad practice and is discouraged.
* Note : It should only be used with SELECT queries and with a limit. If you are not able to defined/know what can be the limit, it
* just means this function is not what you need. Do not use it.
*
* @param string $sql The sql query string
* @return bool|array Result
* @deprecated
* @param string $sql The sql query string. Must end with "... LIMIT x"
* @return bool|array Result
*/
public function getRows($sql)
{
$res = $this->query($sql);
if ($res) {
if (! preg_match('/LIMIT \d+$/', $sql)) {
return false;
}
$resql = $this->query($sql);
if ($resql) {
$results = array();
if ($this->num_rows($res) > 0) {
while ($obj = $this->fetch_object($res)) {
if ($this->num_rows($resql) > 0) {
while ($obj = $this->fetch_object($resql)) {
$results[] = $obj;
}
}
$this->free($resql);
return $results;
}

View file

@ -5,6 +5,7 @@
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -228,8 +229,8 @@ function account_statement_prepare_head($object, $num)
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @param CommonObject $object Object related to tabs
* @return array Array of tabs to shoc
*/
function various_payment_prepare_head($object)
{
@ -275,8 +276,8 @@ function various_payment_prepare_head($object)
/**
* Check SWIFT information for a bank account
*
* @param Account $account A bank account (used to get BIC/SWIFT)
* @param string $swift Swift value (used to get BIC/SWIFT, param $account non used if provided)
* @param ?Account $account A bank account (used to get BIC/SWIFT)
* @param ?string $swift Swift value (used to get BIC/SWIFT, param $account non used if provided)
* @return boolean True if information are valid, false otherwise
*/
function checkSwiftForAccount(Account $account = null, $swift = null)
@ -296,8 +297,8 @@ function checkSwiftForAccount(Account $account = null, $swift = null)
/**
* Check IBAN number information for a bank account.
*
* @param Account $account A bank account
* @param string $ibantocheck Bank account number (used to get BAN, $account not used if provided)
* @param ?Account $account A bank account
* @param ?string $ibantocheck Bank account number (used to get BAN, $account not used if provided)
* @return boolean True if information are valid, false otherwise
*/
function checkIbanForAccount(Account $account = null, $ibantocheck = null)

View file

@ -2116,9 +2116,10 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
if (!empty($conf->use_javascript_ajax)) {
// Add code to open url using the popup. Add also hidden field to retrieve the returned variables
$out .= '<!-- code to open popup and variables to retrieve returned variables -->';
$out .= '<div id="idfordialog'.$name.'" class="hidden">div for dialog</div>';
$out .= '<div id="varforreturndialogid'.$name.'" class="hidden">div for returned id</div>';
$out .= '<div id="varforreturndialoglabel'.$name.'" class="hidden">div for returned label</div>';
$out .= '<div id="idfordialog'.$name.'" class="hidden">'.(getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2 ? 'div for dialog' : '').'</div>';
$out .= '<div id="varforreturndialogid'.$name.'" class="hidden">'.(getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2 ? 'div for returned id' : '').'</div>';
$out .= '<div id="varforreturndialoglabel'.$name.'" class="hidden">'.(getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2 ? 'div for returned label' : '').'</div>';
$out .= '<!-- Add js code to open dialog popup on dialog -->';
$out .= '<script nonce="'.getNonce().'" type="text/javascript">
jQuery(document).ready(function () {
@ -2334,7 +2335,9 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$tabsname = str_replace("@", "", $picto);
}
$out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem valignmiddle">';
$out .= '<div class="tab valignmiddle"><a href="#" class="tab moretab inline-block tabunactive valignmiddle"><span class="hideonsmartphone">'.$langs->trans("More").'</span>... ('.$nbintab.')</a></div>'; // Do not use "reposition" class in the "More".
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
$out .= '<div class="tab valignmiddle"><a href="#" class="tab moretab inline-block tabunactive valignmiddle"><span class="hideonsmartphone">'.$langs->trans("More").'</span>... ('.$nbintab.')</a></div>'; // Do not use "reposition" class in the "More".
}
$out .= '<div id="moretabsList'.$tabsname.'" style="width: '.$widthofpopup.'px; position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px; z-index:10;">';
$out .= $outmore;
$out .= '</div>';
@ -9839,6 +9842,7 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
global $object;
global $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object
$isObBufferActive = false; // When true, the ObBuffer must be cleaned in the exception handler
if (!in_array($onlysimplestring, array('0', '1', '2'))) {
return "Bad call of dol_eval. Parameter onlysimplestring must be '0' (deprecated), '1' or '2'";
}
@ -9957,16 +9961,20 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
if ($returnvalue) {
if ($hideerrors) {
ob_start(); // An evaluation has no reason to output data
$isObBufferActive = true;
$tmps = @eval('return '.$s.';');
$tmpo = ob_get_clean();
$isObBufferActive = false;
if ($tmpo) {
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s;
}
return $tmps;
} else {
ob_start(); // An evaluation has no reason to output data
$isObBufferActive = true;
$tmps = eval('return '.$s.';');
$tmpo = ob_get_clean();
$isObBufferActive = false;
if ($tmpo) {
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s;
}
@ -9981,6 +9989,11 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
}
}
} catch (Error $e) {
if ($isObBufferActive) {
// Clean up buffer which was left behind due to exception.
$tmpo = ob_get_clean();
$isObBufferActive = false;
}
$error = 'dol_eval try/catch error : ';
$error .= $e->getMessage();
dol_syslog($error, LOG_WARNING);
@ -12166,10 +12179,6 @@ function getElementProperties($elementType)
$element = 'supplierproposal';
$classfile = 'supplier_proposal';
$subelement = 'supplierproposal';
// } elseif ($elementType == 'shipping') { // TODO atm-john @2024-03-08 : $elementType == 'shipping' already set. And what is expedition_bon module using class shipping ? This line make no sense ...
// $classpath = 'expedition/class';
// $subelement = 'expedition';
// $module = 'expedition_bon';
} elseif ($elementType == 'delivery') {
$classpath = 'delivery/class';
$subelement = 'delivery';

View file

@ -7,6 +7,7 @@
* Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -892,7 +893,7 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = '
* @param string $table Table containing field with counter
* @param string $field Field containing already used values of counter
* @param string $where To add a filter on selection (for example to filter on invoice types)
* @param Societe $objsoc The company that own the object we need a counter for
* @param Societe|string $objsoc The company that own the object we need a counter for
* @param string $date Date to use for the {y},{m},{d} tags.
* @param string $mode 'next' for next value or 'last' for last value
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
@ -2511,16 +2512,16 @@ function colorLighten($hex, $percent)
/**
* @param string $hex color in hex
* @param float $alpha 0 to 1 to add alpha channel
* @param bool $returnArray true=return an array instead, false=return string
* @return string|array String or array
* @param string $hex color in hex
* @param float|false $alpha 0 to 1 to add alpha channel
* @param bool $returnArray true=return an array instead, false=return string
* @return string|array String or array
*/
function colorHexToRgb($hex, $alpha = false, $returnArray = false)
{
$string = '';
$hex = str_replace('#', '', $hex);
$length = strlen($hex);
$hex = str_replace('#', '', $hex);
$length = strlen($hex);
$rgb = array();
$rgb['r'] = hexdec($length == 6 ? substr($hex, 0, 2) : ($length == 3 ? str_repeat(substr($hex, 0, 1), 2) : 0));
$rgb['g'] = hexdec($length == 6 ? substr($hex, 2, 2) : ($length == 3 ? str_repeat(substr($hex, 1, 1), 2) : 0));

View file

@ -149,7 +149,7 @@ if (!function_exists('dol_loginfunction')) {
// Title
$appli = constant('DOL_APPLICATION_TITLE');
$title = $appli.' '.constant('DOL_VERSION');
$title = $appli.(getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' : ' '.constant('DOL_VERSION'));
if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
$title = getDolGlobalString('MAIN_APPLICATION_TITLE');
}

View file

@ -4,6 +4,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2023 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -237,7 +238,7 @@ function group_prepare_head($object)
$canreadperms = true;
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
$canreadperms = ($user->admin || $user->rights->user->group_advance->readperms);
$canreadperms = ($user->admin || $user->hasRight('user', 'group_advance', 'readperms'));
}
$h = 0;
@ -504,17 +505,17 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
//Nothing
} else {
$listofdarkmodes = array(
'0' => $langs->trans("AlwaysDisabled"),
'1' => $langs->trans("AccordingToBrowser"),
'2' => $langs->trans("AlwaysEnabled")
$langs->trans("AlwaysDisabled"),
$langs->trans("AccordingToBrowser"),
$langs->trans("AlwaysEnabled")
);
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DarkThemeMode").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0);
print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, getDolGlobalInt('THEME_DARKMODEENABLED'));
} else {
print $listofdarkmodes[isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0];
print $listofdarkmodes[getDolGlobalInt('THEME_DARKMODEENABLED')];
}
print $form->textwithpicto('', $langs->trans("DoesNotWorkWithAllThemes"));
print '</tr>';
@ -545,11 +546,11 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '</td>';*/
} else {
$listoftopmenumodes = array(
'0' => $langs->transnoentitiesnoconv("IconAndText"),
'1' => $langs->transnoentitiesnoconv("TextOnly"),
'2' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"),
'3' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover"),
'4' => $langs->transnoentitiesnoconv("IconOnly"),
$langs->transnoentitiesnoconv("IconAndText"),
$langs->transnoentitiesnoconv("TextOnly"),
$langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"),
$langs->transnoentitiesnoconv("IconOnlyTextOnHover"),
$langs->transnoentitiesnoconv("IconOnly"),
);
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
@ -637,13 +638,10 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
if ($edit)
{
if ($edit) {
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','',1).' ';
}
else
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
} else {
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print '';
}

View file

@ -178,7 +178,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout
}
$showmode = 1;
if (empty($noout)) {
if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode);
print_end_menu_entry_auguria($showmode);
print_end_menu_array_auguria();

View file

@ -590,7 +590,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
}
$showmode = 1;
if (empty($noout)) {
if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
print_start_menu_entry('', 'class="tmenuend"', $showmode);
print_end_menu_entry($showmode);
print_end_menu_array();

View file

@ -139,7 +139,7 @@ class MenuManager
}
$showmode = 1;
if (empty($noout)) {
if (empty($noout) && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
}
if (empty($noout)) {

View file

@ -8,6 +8,7 @@
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -140,7 +141,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $menu = array();
/**
* @var array{triggers:int,login:int,substitutions:int,menus:int,theme:int,tpl:int,barcode:int,models:int,css:string,js:string,hooks:string[]} Module parts
* @var array{triggers?:int<0,1>,login?:int<0,1>,substitutions?:int<0,1>,menus?:int<0,1>,theme?:int<0,1>,tpl?:int<0,1>,barcode?:int<0,1>,models?:int<0,1>,printing?:int<0,1>,css?:string[],js?:string[],hooks?:array{data:string[],entity:string},moduleforexternal?:int<0,1>,websitetemplates?:int<0,1>,contactelement?:int<0,1>} Module parts
* array(
* // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers)
* 'triggers' => 0,

View file

@ -254,8 +254,8 @@ class doc_generic_asset_odt extends ModelePDFAsset
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -78,8 +78,8 @@ class mod_asset_standard extends ModeleNumRefAsset
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -118,7 +118,7 @@ class mod_asset_standard extends ModeleNumRefAsset
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @param Asset $object Object we need next value for
* @return string|-1 Next value if OK, -1 if KO
*/
public function getNextValue($object)

View file

@ -127,8 +127,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
/**
* Return literal barcode type code from numerical rowid type of barcode
*
* @param Database $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @param DoliDB $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
public function literalBarcodeType($db, $type = 0)
@ -157,9 +157,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
/**
* Return next value
*
* @param Product $objproduct Object product
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO
* @param CommonObject $objproduct Object product
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
public function getNextValue($objproduct, $type = '')
{

View file

@ -139,7 +139,7 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
/**
* Return literal barcode type code from numerical rowid type of barcode
*
* @param Database $db Database
* @param DoliDB $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
@ -169,9 +169,9 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode
/**
* Return next value
*
* @param Societe $objthirdparty Object third-party
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO
* @param CommonObject $objthirdparty Object third-party
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO
*/
public function getNextValue($objthirdparty, $type = '')
{

View file

@ -62,11 +62,11 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
/**
* Return next value available
*
* @param Product $objproduct Object Product
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value
* @param CommonObject $objcommon CommonObject
* @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value
*/
public function getNextValue($objproduct, $type = '')
public function getNextValue($objcommon, $type = '')
{
global $langs;
return $langs->trans("Function_getNextValue_InModuleNotWorking");

View file

@ -264,8 +264,8 @@ class doc_generic_bom_odt extends ModelePDFBom
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -119,7 +119,7 @@ class mod_bom_advanced extends ModeleNumRefBoms
* Return next free value
*
* @param Product $objprod Object product
* @param Object $object Object we need next value for
* @param Bom $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objprod, $object)

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -76,8 +77,8 @@ class mod_bom_standard extends ModeleNumRefBoms
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -112,9 +113,9 @@ class mod_bom_standard extends ModeleNumRefBoms
/**
* Return next free value
*
* @param Product $objprod Object product
* @param Object $object Object we need next value for
* @return string|-1 Next value if OK, -1 if KO
* @param Product $objprod Object product
* @param Bom $object Object we need next value for
* @return string|-1 Next value if OK, -1 if KO
*/
public function getNextValue($objprod, $object)
{

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -73,7 +74,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
@ -150,19 +151,4 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function chequereceipt_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -131,19 +131,4 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function chequereceipt_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -270,8 +270,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -88,8 +89,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -125,7 +126,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Commande $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $object)
@ -165,19 +166,4 @@ class mod_commande_marbre extends ModeleNumRefCommandes
dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string|-1 Next free value, -1 if KO
*/
public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -119,7 +119,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Commande $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objsoc, $object)
@ -149,19 +149,4 @@ class mod_commande_saphir extends ModeleNumRefCommandes
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -268,8 +268,8 @@ class doc_generic_contract_odt extends ModelePDFContract
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -105,7 +105,7 @@ class mod_contract_magre extends ModelNumRefContracts
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $contract contract object
* @param Contrat $contract contract object
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objsoc, $contract)
@ -125,18 +125,4 @@ class mod_contract_magre extends ModelNumRefContracts
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $objforref contract object
* @return string|0 Value if OK, 0 if KO
*/
public function contract_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -76,8 +76,8 @@ class mod_contract_serpis extends ModelNumRefContracts
/**
* Test if existing numbers make problems with numbering
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -113,7 +113,7 @@ class mod_contract_serpis extends ModelNumRefContracts
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $contract contract object
* @param Contrat $contract contract object
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $contract)
@ -151,19 +151,4 @@ class mod_contract_serpis extends ModelNumRefContracts
dol_syslog("mod_contract_serpis::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $objforref contract object
* @return string|-1 Value if OK, -1 if KO
*/
public function contract_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -86,8 +87,8 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -126,7 +127,7 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Delivery $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $object)
@ -168,19 +169,4 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder
dol_syslog("mod_delivery_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free ref
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object livraison
* @return string|-1 Value if OK, -1 if KO
*/
public function delivery_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -121,7 +122,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
* Return next value
*
* @param Societe $objsoc Object third party
* @param Object $object Object delivery
* @param Delivery $object Object delivery
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $object)
@ -148,26 +149,12 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param Delivery $objforref Object for number to search
* @return string|0 Next free value, 0 if KO
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{
return $this->getNextValue($objsoc, $objforref);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free ref
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object livraison
* @return string|0 Value if OK, 0 if KO
*/
public function delivery_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
}

View file

@ -268,8 +268,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -117,7 +117,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
* Return next value
*
* @param Societe $objsoc Third party object
* @param Object $shipment Shipment object
* @param Expedition $shipment Shipment object
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $shipment)
@ -139,18 +139,4 @@ class mod_expedition_ribera extends ModelNumRefExpedition
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Third party object
* @param Object $objforref Shipment object
* @return string|0 Next free value, 0 if KO
*/
public function expedition_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -81,8 +82,8 @@ class mod_expedition_safor extends ModelNumRefExpedition
/**
* Test if existing numbers make problems with numbering
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -118,7 +119,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
* Return next value
*
* @param Societe $objsoc Third party object
* @param Object $shipment Shipment object
* @param Expedition $shipment Shipment object
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $shipment)
@ -156,18 +157,4 @@ class mod_expedition_safor extends ModelNumRefExpedition
dol_syslog("mod_expedition_safor::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Third party object
* @param Object $objforref Shipment object
* @return string|-1 Next free value, -1 if KO
*/
public function expedition_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -82,8 +83,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -120,8 +121,8 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
* @param ExpenseReport $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($object)
{

View file

@ -268,8 +268,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -96,8 +97,8 @@ class mod_facture_mars extends ModeleNumRefFactures
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -243,9 +244,10 @@ class mod_facture_mars extends ModeleNumRefFactures
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param Facture $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref, $mode = 'next')
{

View file

@ -3,8 +3,9 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2013 uanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -178,9 +179,10 @@ class mod_facture_mercure extends ModeleNumRefFactures
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param Facture $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string|0 Next free value, 0 if KO
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref, $mode = 'next')
{

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -112,8 +113,8 @@ class mod_facture_terre extends ModeleNumRefFactures
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -283,9 +284,10 @@ class mod_facture_terre extends ModeleNumRefFactures
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param Facture $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string|int<-1,0> Next free value, -1 or 0 if error
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref, $mode = 'next')
{

View file

@ -6,6 +6,7 @@
* Copyright (C) 2011 Fabrice CHERRIER
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -449,7 +450,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @param Fichinter $object FichInter Object
* @param ?Fichinter $object FichInter Object
* @return void
*/
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, FichInter $object = null)

View file

@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -121,7 +122,7 @@ class mod_arctic extends ModeleNumRefFicheinter
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Fichinter $object Object we need next value for
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc = 0, $object = '')
@ -148,8 +149,9 @@ class mod_arctic extends ModeleNumRefFicheinter
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @param Fichinter $objforref Object for number to search
* @return string|0 Next free value, 0 if KO
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -82,8 +83,8 @@ class mod_pacific extends ModeleNumRefFicheinter
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -121,7 +122,7 @@ class mod_pacific extends ModeleNumRefFicheinter
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @param Fichinter $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
public function getNextValue($objsoc = 0, $object = '')
@ -161,9 +162,10 @@ class mod_pacific extends ModeleNumRefFicheinter
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @return string Next free value
* @param Societe $objsoc Object third party
* @param Fichinter $objforref Object for number to search
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{

View file

@ -105,7 +105,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $holiday holiday object
* @param Holiday $holiday holiday object
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $holiday)
@ -125,18 +125,4 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
* @param User $fuser User object
* @param Object $objforref Holiday object
* @return string|0 Value if OK, 0 if KO
*/
public function holiday_get_num($fuser, $objforref)
{
// phpcs:enable
return $this->getNextValue($fuser, $objforref);
}
}

View file

@ -77,8 +77,8 @@ class mod_holiday_madonna extends ModelNumRefHolidays
/**
* Test if existing numbers make problems with numbering
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -114,7 +114,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays
* Return next value
*
* @param Societe $objsoc third party object
* @param Object $holiday Holiday object
* @param Holiday $holiday Holiday object
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $holiday)
@ -152,19 +152,4 @@ class mod_holiday_madonna extends ModelNumRefHolidays
dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next value
*
* @param User $fuser User object
* @param Object $objforref Holiday object
* @return string|-1 Value if OK, -1 if KO
*/
public function holiday_get_num($fuser, $objforref)
{
// phpcs:enable
return $this->getNextValue($fuser, $objforref);
}
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -123,7 +123,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @param Evaluation $object Object we need next value for
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($object)

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -77,7 +78,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
@ -117,7 +118,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @param Evaluation $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($object)

View file

@ -260,8 +260,8 @@ class doc_generic_member_odt extends ModelePDFMember
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -79,7 +79,7 @@ class mod_member_advanced extends ModeleNumRefMembers
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)

View file

@ -79,7 +79,7 @@ class mod_member_simple extends ModeleNumRefMembers
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)

View file

@ -257,8 +257,8 @@ class doc_generic_mo_odt extends ModelePDFMo
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* This program is free software; you can redistribute it and/or modify
@ -120,7 +120,7 @@ class mod_mo_advanced extends ModeleNumRefMos
* Return next free value
*
* @param Product $objprod Object product
* @param Object $object Object we need next value for
* @param Mo $object Object we need next value for
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objprod, $object)

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -76,7 +77,7 @@ class mod_mo_standard extends ModeleNumRefMos
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
@ -113,7 +114,7 @@ class mod_mo_standard extends ModeleNumRefMos
* Return next free value
*
* @param Product $objprod Object product
* @param Object $object Object we need next value for
* @param Mo $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objprod, $object)

View file

@ -266,8 +266,8 @@ class doc_generic_product_odt extends ModelePDFProduct
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -77,7 +78,7 @@ class mod_lot_standard extends ModeleNumRefBatch
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -77,7 +78,7 @@ class mod_sn_standard extends ModeleNumRefBatch
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)

View file

@ -555,8 +555,8 @@ class doc_generic_project_odt extends ModelePDFProjects
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -85,7 +86,7 @@ class mod_project_simple extends ModeleNumRefProjects
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -150,19 +151,4 @@ class mod_project_universal extends ModeleNumRefProjects
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next reference not yet used as a reference
*
* @param Societe $objsoc Object third party
* @param Project $project Object project
* @return string|0 Next not used reference, 0 if KO
*/
public function project_get_num($objsoc = 0, $project = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $project);
}
}

View file

@ -303,8 +303,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -85,7 +86,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
@ -167,8 +168,9 @@ class mod_propale_marbre extends ModeleNumRefPropales
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @param Propal $objforref Object for number to search
* @return string|-1 Next free value, -1 if KO
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{

View file

@ -262,8 +262,8 @@ class doc_generic_reception_odt extends ModelePdfReception
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -61,7 +62,7 @@ class mod_reception_beryl extends ModelNumRefReception
/**
* Test if existing numbers make problems with numbering
*
* @param Object $object Object we need next value for
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
@ -98,7 +99,7 @@ class mod_reception_beryl extends ModelNumRefReception
* Return next value
*
* @param Societe $objsoc Third party object
* @param Object $reception Reception object
* @param Reception $reception Reception object
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $reception)
@ -136,18 +137,4 @@ class mod_reception_beryl extends ModelNumRefReception
dol_syslog("mod_reception_beryl::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Third party object
* @param Object $objforref Shipment object
* @return string|-1 Next free value, -1 if KO
*/
public function reception_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -98,7 +98,7 @@ class mod_reception_moonstone extends ModelNumRefReception
* Return next value
*
* @param Societe $objsoc Third party object
* @param Object|null $reception Reception object
* @param Reception|null $reception Reception object
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $reception)
@ -124,18 +124,4 @@ class mod_reception_moonstone extends ModelNumRefReception
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Third party object
* @param Object $objforref Reception object
* @return string|0 Next free value, 0 if KO
*/
public function reception_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -248,8 +248,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)) . '-' . $newfiletmp;
$newfiletmp = preg_replace('/__+/', '_', $newfiletmp); // Replace repeated _ into one _ (to avoid string with substitution syntax)
}
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -125,7 +125,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param societe $objsoc Object thirdparty
* @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/

View file

@ -77,7 +77,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param societe $objsoc Object thirdparty
* @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/
@ -89,7 +89,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
/**
* Return an example of result returned by getNextValue
*
* @param societe $objsoc Object thirdparty
* @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return next value
*/

View file

@ -77,7 +77,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param societe $objsoc Object thirdparty
* @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/

View file

@ -3,6 +3,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -130,7 +131,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param societe $objsoc Object thirdparty
* @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Return string example
*/

View file

@ -269,8 +269,8 @@ class doc_generic_stock_odt extends ModelePDFStock
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -124,8 +124,8 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @return string|0 Value if OK, 0 if KO
* @param StockTransfer $object Object we need next value for
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($object)
{

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -78,8 +79,8 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
@ -118,8 +119,8 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
* @param StockTransfer $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($object)
{

View file

@ -266,8 +266,8 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -91,8 +92,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Tests if the numbers already in the database do not cause conflicts that would prevent this numbering.
*
* @param Object $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
{
@ -173,10 +174,10 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Return next value
*
* @param Societe $objsoc Object third party
* @param Object $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|-1 Value if OK, -1 if KO
* @param Societe $objsoc Object third party
* @param FactureFournisseur $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $object, $mode = 'next')
{
@ -256,10 +257,11 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
* @param Societe $objsoc Object third party
* @param FactureFournisseur $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref, $mode = 'next')
{

View file

@ -5,6 +5,7 @@
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -31,8 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefo
/**
\class mod_facture_fournisseur_tulip
\brief Tulip Class of numbering models of suppliers invoices references
* \class mod_facture_fournisseur_tulip
* \brief Tulip Class of numbering models of suppliers invoices references
*/
class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
{
@ -146,10 +147,10 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
/**
* Return next value
*
* @param Societe $objsoc Object third party
* @param Object $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|0 Value if OK, 0 if KO
* @param Societe $objsoc Object third party
* @param FactureFournisseur $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc, $object, $mode = 'next')
{
@ -185,10 +186,11 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
* @param Societe $objsoc Object third party
* @param FactureFournisseur $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref, $mode = 'next')
{

View file

@ -262,8 +262,8 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -95,8 +96,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
{
@ -130,9 +131,9 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
/**
* Return next value
*
* @param Societe $objsoc Object third party
* @param Object $object Object
* @return string Value if OK, 0 if KO
* @param Societe $objsoc Object third party
* @param CommandeFournisseur $object Object
* @return string Value if OK, 0 if KO
*/
public function getNextValue($objsoc = 0, $object = '')
{
@ -170,19 +171,4 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la reference de commande suivante non utilisee
*
* @param Societe $objsoc Object third party
* @param Object $object Object
* @return string Descriptive text
*/
public function commande_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -121,9 +122,9 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
/**
* Return next value
*
* @param Societe $objsoc Object third party
* @param Object $object Object
* @return string|0 Value if OK, 0 if KO
* @param Societe $objsoc Object third party
* @param CommandeFournisseur $object Object
* @return string|0 Value if OK, 0 if KO
*/
public function getNextValue($objsoc = 0, $object = '')
{
@ -143,19 +144,4 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la reference de commande suivante non utilisee
*
* @param Societe $objsoc Object third party
* @param Object $object Object
* @return string Descriptive text
*/
public function commande_get_num($objsoc = 0, $object = '')
{
// phpcs:enable
return $this->getNextValue($objsoc, $object);
}
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -118,9 +119,9 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
/**
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
* @param Societe $objsoc Object thirdparty
* @param PaiementFourn $object Object we need next value for
* @return string|0 Next value if OK, 0 if KO
*/
public function getNextValue($objsoc, $object)
{
@ -140,19 +141,4 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments
return $numFinal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function commande_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -83,8 +84,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
{
@ -119,9 +120,9 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
/**
* Return next free value
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
* @param Societe $objsoc Object thirdparty
* @param PaiementFourn $object Object we need next value for
* @return string|-1 Value if OK, -1 if KO
*/
public function getNextValue($objsoc, $object)
{
@ -160,19 +161,4 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @return string Next free value
*/
public function payment_get_num($objsoc, $objforref)
{
// phpcs:enable
return $this->getNextValue($objsoc, $objforref);
}
}

View file

@ -290,8 +290,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -85,8 +86,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
{
@ -166,9 +167,10 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
/**
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @return string Next free value
* @param Societe $objsoc Object third party
* @param SupplierProposal $objforref Object for number to search
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{

View file

@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -85,8 +86,8 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* Test if the numbers already in the database do not cause any conflicts that will prevent this
* of conflicts that will prevent this numbering from working.
*
* @param Object $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
* @param CommonObject $object Object we need next value for
* @return boolean false if KO (there is a conflict), true if OK
*/
public function canBeActivated($object)
{
@ -208,8 +209,9 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @param Facture $objforref Object for number to search
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{

View file

@ -5,6 +5,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -151,8 +152,9 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
* Return next free value
*
* @param Societe $objsoc Object third party
* @param Object $objforref Object for number to search
* @param Facture $objforref Object for number to search
* @return string Next free value
* @deprecated see getNextValue
*/
public function getNumRef($objsoc, $objforref)
{

View file

@ -258,8 +258,8 @@ class doc_generic_ticket_odt extends ModelePDFTicket
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (getDolGlobalInt('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalInt('MAIN_DOC_USE_TIMING');
if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
$format = getDolGlobalString('MAIN_DOC_USE_TIMING');
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -81,8 +82,8 @@ class mod_ticket_simple extends ModeleNumRefTicket
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
* @param CommonObject $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{

Some files were not shown because too many files have changed in this diff Show more