Merge branch 'develop' into ci/improve_fail_test

This commit is contained in:
MDW 2024-03-16 23:35:32 +01:00 committed by GitHub
commit 4b0a6a2c0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
141 changed files with 557 additions and 953 deletions

View file

@ -11,6 +11,7 @@ aplphanothtml->alphanohtml
choosed->chosen
dokument->document
dolibar->dolibarr
dolibarrr->dolibarr
dollibar->dolibarr
dollibarr->dolibarr
# fiche->card

View file

@ -326,6 +326,7 @@ $usercanread = (($user->hasRight('stock', 'mouvement', 'lire')));
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere.
- New: Add proposals into referer page of thirdparty.
AmountIn
NEW: ModuleBuilder: Checkin comments begin and end before each actions
for /F "tokens=2 delims=," %%i in ('tasklist /FI "IMAGENAME eq php.exe" /FO CSV /NH') do (
foreach ($TWeek as $week_number) {

View file

@ -79,7 +79,6 @@ return [
'htdocs/core/modules/societe/modules_societe.class.php' => ['PhanTypeMismatchReturn'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/expedition/class/api_shipments.class.php' => ['PhanTypeMismatchReturn'],
'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanTypeMismatchReturn'],

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* 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
@ -241,7 +242,7 @@ if ($action == 'create') {
// Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
print '<td>';
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, [], 0, 0, 'minwidth200');
print '</td></tr>';
// Chart of accounts type

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2017-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2022 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
@ -164,7 +165,7 @@ if (!empty($cat_id)) {
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"');
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), 0, 0, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
print '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
}
}

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* 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
@ -305,9 +306,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if (GETPOST('actioncancel', 'alpha')) {
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
// if (GETPOST('actioncancel', 'alpha')) {
// $_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
// }
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
$rowidcol = "rowid";

View file

@ -24,7 +24,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
$code = getDolGlobalString('MAIN_INFO_ACCOUNTANT_CODE');

View file

@ -19,7 +19,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
?>

View file

@ -19,7 +19,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -19,7 +19,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -21,7 +21,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -104,7 +104,7 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -115,7 +115,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -125,7 +125,7 @@ if ($action == 'updateMask') {
}
}/* elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -141,7 +141,7 @@ if ($action == 'updateMask') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);

View file

@ -69,7 +69,12 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$moduledir = 'hrm';
$myTmpObjects = array();
// TODO Scan list of objects to fill this array
$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0);
$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Evaluation');
$tmpobjectkey = GETPOST('object', 'aZ09');
if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
accessforbidden('Bad value for object. Hack attempt ?');
}
/*
@ -112,47 +117,43 @@ if ($action == 'update') {
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
} elseif ($action == 'specimen' && $tmpobjectkey) {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (array_key_exists($tmpobjectkey, $myTmpObjects)) {
$nameofclass = ucfirst($tmpobjectkey);
$tmpobject = new $nameofclass($db);
$tmpobject->initAsSpecimen();
$className = $myTmpObjects[$tmpobjectkey]['class'];
$tmpobject = new $className($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$classname = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$classname = "pdf_".$modele;
break;
}
// Search template files
$file = '';
$classname = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$classname = "pdf_".$modele;
break;
}
}
if ($classname !== '') {
require_once $file;
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -163,7 +164,6 @@ if ($action == 'update') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -173,7 +173,6 @@ if ($action == 'update') {
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -189,7 +188,6 @@ if ($action == 'update') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);

View file

@ -63,11 +63,20 @@ if (!$user->admin) {
accessforbidden();
}
if (!getDolGlobalString('KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON')) {
$conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON = 'mod_knowledgerecord_standard';
}
$moduledir = 'knowledgemanagement';
$myTmpObjects = array();
// TODO Scan list of objects to fill this array
$myTmpObjects['knowledgemanagement'] = array('label' => 'KnowledgeManagement', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'KnowledgeRecord');
$tmpobjectkey = GETPOST('object', 'aZ09');
if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
accessforbidden('Bad value for object. Hack attempt ?');
}
/*
* Actions
@ -91,47 +100,43 @@ if ($action == 'updateMask') {
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
} elseif ($action == 'specimen' && $tmpobjectkey) {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (array_key_exists($tmpobjectkey, $myTmpObjects)) {
$className = $myTmpObjects[$tmpobjectkey]['class'];
$tmpobject = new $className($db);
$tmpobject->initAsSpecimen();
$className = $myTmpObjects[$tmpobjectkey]['class'];
$tmpobject = new $className($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$className = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$className = "pdf_".$modele;
break;
}
// Search template files
$file = '';
$className = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$className = "pdf_".$modele;
break;
}
}
if ($className !== '') {
require_once $file;
if ($className !== '') {
require_once $file;
$module = new $className($db);
$module = new $className($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -142,7 +147,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -152,7 +157,6 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -168,7 +172,6 @@ if ($action == 'updateMask') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);

View file

@ -92,7 +92,7 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -103,7 +103,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -113,7 +113,7 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -129,7 +129,7 @@ if ($action == 'updateMask') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);

View file

@ -53,8 +53,12 @@ if (!$user->admin) {
$moduledir = 'workstation';
$myTmpObjects = array();
$myTmpObjects['workstation'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0);
$myTmpObjects['workstation'] = array('label' => 'Workstation', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Workstation');
$tmpobjectkey = GETPOST('object', 'aZ09');
if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
accessforbidden('Bad value for object. Hack attempt ?');
}
/*
@ -82,48 +86,43 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (array_key_exists($tmpobjectkey, $myTmpObjects)) {
$nameofclass = ucfirst($tmpobjectkey);
$tmpobject = new $nameofclass($db);
$tmpobject->initAsSpecimen();
$nameofclass = ucfirst($tmpobjectkey);
$tmpobject = new $nameofclass($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$classname = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$classname = "pdf_".$modele;
break;
}
// Search template files
$file = '';
$classname = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$classname = "pdf_".$modele;
break;
}
}
if ($classname !== '') {
require_once $file;
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'set') {
// Activate a model
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$tmpobjectkey = GETPOST('object');
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
@ -133,7 +132,6 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setdoc') {
// Set default model
$tmpobjectkey = GETPOST('object');
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
@ -149,7 +147,6 @@ if ($action == 'updateMask') {
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated
// by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
$constforval = 'WORKSTATION_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}

View file

@ -207,7 +207,7 @@ if ($action == 'deleteproperty') {
}
if ($action == 'edit') {
$out .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="action" value="update">';

View file

@ -88,68 +88,6 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') {
$maskconst = GETPOST('maskconst', 'aZ09');
$maskvalue = GETPOST('maskvalue', 'alpha');
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'set') {
// Activate a model
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->$constforval = $value;
}
// We disable/enable the document template (into llx_document_model table)
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
$action = 'edit';

View file

@ -69,7 +69,7 @@ $generatedContent = $ai->generateContent($instructions, 'auto', $function, $form
if (is_array($generatedContent) && $generatedContent['error']) {
// Output error
if ($generatedContent['code'] == 429) {
if (!empty($generatedContent['code']) && $generatedContent['code'] == 429) {
print "Quota or allowed period exceeded. Retry Later !";
} elseif ($generatedContent['code'] >= 400) {
print "Error : " . $generatedContent['message'];

View file

@ -28,6 +28,7 @@ class Ai
* @var DoliDB $db Database object
*/
protected $db;
/**
* @var string $apiEndpoint
*/
@ -131,9 +132,12 @@ class Ai
'Authorization: Bearer ' . $this->apiKey,
'Content-Type: application/json'
]);
$response = getURLContent($this->apiEndpoint, 'POST', $payload, $headers);
$response = getURLContent($this->apiEndpoint, 'POST', $payload, 1, $headers);
if ($response['http_code'] != 200) {
if (empty($response['http_code'])) {
throw new Exception('API request failed. No http received');
}
if (!empty($response['http_code']) && $response['http_code'] != 200) {
throw new Exception('API request failed with status code ' . $response['http_code']);
}
// Decode JSON response
@ -149,7 +153,17 @@ class Ai
return $generatedEmailContent;
} catch (Exception $e) {
return array('error' => true, 'message' => $e->getMessage());
$errormessage = $e->getMessage();
if (!empty($response['content'])) {
$decodedResponse = json_decode($response['content'], true);
// With OpenAI, error is into an object error into the content
if (!empty($decodedResponse['error']['message'])) {
$errormessage .= ' - '.$decodedResponse['error']['message'];
}
}
return array('error' => true, 'message' => $errormessage, 'code' => (empty($response['http_code']) ? 0 : $response['http_code']), 'curl_error_no' => (empty($response['curl_error_no']) ? $response['curl_error_no'] : ''));
}
}
}

View file

@ -66,7 +66,12 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$moduledir = 'asset';
$myTmpObjects = array();
$myTmpObjects['Asset'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0);
$myTmpObjects['asset'] = array('label' => 'Asset', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Asset');
$tmpobjectkey = GETPOST('object', 'aZ09');
if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
accessforbidden('Bad value for object. Hack attempt ?');
}
/*
@ -91,47 +96,43 @@ if ($action == 'updateMask') {
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
} elseif ($action == 'specimen' && $tmpobjectkey) {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (array_key_exists($tmpobjectkey, $myTmpObjects)) {
$nameofclass = ucfirst($tmpobjectkey);
$tmpobject = new $nameofclass($db);
$tmpobject->initAsSpecimen();
$className = $myTmpObjects[$tmpobjectkey]['class'];
$tmpobject = new $className($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$classname = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$classname = "pdf_".$modele;
break;
}
// Search template files
$file = '';
$classname = '';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$classname = "pdf_".$modele;
break;
}
}
if ($classname !== '') {
require_once $file;
if ($classname !== '') {
require_once $file;
$module = new $classname($db);
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'ASSET_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -142,7 +143,6 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -152,7 +152,6 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -168,7 +167,6 @@ if ($action == 'updateMask') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
@ -201,11 +199,7 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "asse
echo '<span class="opacitymedium">'.$langs->trans("AssetSetupPage").'</span>';
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') {
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
/*
* Assets Numbering model
@ -278,7 +272,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$className = $myTmpObjectArray['class'];
$mytmpinstance = new $className($db);
$mytmpinstance->initAsSpecimen();
// Info

View file

@ -27,7 +27,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {

View file

@ -28,7 +28,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {

View file

@ -27,7 +27,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {

View file

@ -28,7 +28,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {

View file

@ -27,7 +27,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -21,7 +21,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php";
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
'@phan-var-force CommonObject $this

View file

@ -36,7 +36,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
'@phan-var-force CommonObject $this

View file

@ -41,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
'@phan-var-force CommonObject $this

View file

@ -138,7 +138,7 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -149,7 +149,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -159,7 +159,7 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -175,7 +175,7 @@ if ($action == 'updateMask') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (!empty($tmpobjectkey)) {
$constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
@ -207,7 +207,6 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "fa-c
// Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("BookCalSetupPage").'</span><br><br>';
if ($action == 'edit') {
print $formSetup->generateOutput(true);
print '<br>';

View file

@ -26,7 +26,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
?>

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -19,7 +19,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -5646,7 +5646,7 @@ abstract class CommonObject
$filefound = dol_sanitizePathName($filefound);
// If generator was found
global $db; // Required to solve a conception default making an include of some code that uses $db instead of $this->db just after.
global $db; // Required to solve a conception error making an include of some code that uses $db instead of $this->db just after.
require_once $filefound;

View file

@ -1455,8 +1455,9 @@ class FormMail extends Form
$out .= '<td>';
$out .= '<input type="text" class="quatrevingtpercent" id="ai_instructions" name="instruction" placeholder="'.$langs->trans("EnterYourAIPromptHere").'..." />';
$out .= '<input id="generate_button" type="button" class="button smallpaddingimp" value="'.$langs->trans('Generate').'"/>';
$out .= '<div id="ai_status_message" class="fieldrequired hideobject marginrightonly" >';
$out .= '<i class="fa fa-spinner fa-spin fa-2x fa-fw"></i>'.$langs->trans("AIProcessingPleaseWait").'</div>';
$out .= '<div id="ai_status_message" class="fieldrequired hideobject marginrightonly">';
$out .= '<i class="fa fa-spinner fa-spin fa-2x fa-fw"></i>'.$langs->trans("AIProcessingPleaseWait");
$out .= '</div>';
$out .= "</td></tr>\n";
$out .= "<script type='text/javascript'>
@ -1471,15 +1472,24 @@ class FormMail extends Form
$('#generate_button').click(function() {
var instructions = $('#ai_instructions').val();
var timeoutfinished = 0;
var apicallfinished = 0;
$('#ai_status_message').show();
$('.icon-container .loader').show();
setTimeout(function() {
timeoutfinished = 1;
if (apicallfinished) {
$('#ai_status_message').hide();
}
}, 2000);
//editor on readonly
if (CKEDITOR.instances.".$htmlContent.") {
CKEDITOR.instances.".$htmlContent.".setReadOnly(1);
}
$.ajax({
url: '". DOL_URL_ROOT."/ai/ajax/generate_content.php?token=".currentToken()."',
type: 'POST',
@ -1501,9 +1511,10 @@ class FormMail extends Form
// remove readonly
$('#ai_instructions').val('');
setTimeout(function() {
apicallfinished = 1;
if (timeoutfinished) {
$('#ai_status_message').hide();
}, 3000);
}
},
error: function(xhr, status, error) {
alert(error);

View file

@ -111,8 +111,8 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
}
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, !getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
curl_setopt($ch, CURLOPT_TIMEOUT, !getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 5));
curl_setopt($ch, CURLOPT_TIMEOUT, getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30));
// limit size of downloaded files. TODO Add MAIN_SECURITY_MAXFILESIZE_DOWNLOADED
$maxsize = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED');

View file

@ -30,7 +30,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -29,7 +29,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -28,7 +28,7 @@
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
global $action, $form, $langs;

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
// Require

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($blocname)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
$hide = true; // Hide by default

View file

@ -32,7 +32,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
$fileparams = array();

View file

@ -25,7 +25,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
?>

View file

@ -25,7 +25,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {
$form = new Form($db);

View file

@ -26,7 +26,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {
$form = new Form($db);

View file

@ -27,7 +27,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (empty($preselectedtypeofcontact)) {

View file

@ -32,7 +32,7 @@
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -28,7 +28,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
?>

View file

@ -28,7 +28,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
?>

View file

@ -11,7 +11,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (empty($extrafieldsobjectkey) && is_object($object)) {

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (empty($extrafieldsobjectkey) && is_object($object)) {

View file

@ -5,7 +5,7 @@ print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (empty($extrafieldsobjectkey) && is_object($object)) {

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
// Loop to complete $param for extrafields

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (empty($extrafieldsobjectkey) && is_object($object)) {

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (empty($extrafieldsobjectkey) && is_object($object)) {

View file

@ -29,7 +29,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!is_object($form)) {

View file

@ -27,7 +27,7 @@ if (!defined('NOBROWSERNOTIF')) {
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
// DDOS protection

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
// $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create

View file

@ -36,7 +36,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -37,7 +37,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
'@phan-var-force CommonObject $this

View file

@ -41,7 +41,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
'@phan-var-force CommonObject $this

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
$objectUrl = $object->getNomUrl(0, '', 0, 1);

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
?>

View file

@ -23,7 +23,7 @@ if (!defined('NOBROWSERNOTIF')) {
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
// DDOS protection

View file

@ -25,7 +25,7 @@ if (!defined('NOBROWSERNOTIF')) {
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
// DDOS protection

View file

@ -4,7 +4,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -52,7 +52,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code

View file

@ -56,7 +56,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database:

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Florian Henry <florian.henry@scopen.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
@ -47,7 +48,7 @@ class InterfaceEventOrganization extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database:
@ -74,13 +75,13 @@ class InterfaceEventOrganization extends DolibarrTriggers
return 0; // Module not active, we do nothing
}
$error=0;
$error = 0;
// Actions
if ($action == 'PROJECT_VALIDATE') {
if (getDolGlobalString('EVENTORGANIZATION_TASK_LABEL') && !empty($object->usage_organize_event)) {
$taskToDo = explode("\n", getDolGlobalString('EVENTORGANIZATION_TASK_LABEL'));
if (is_array($taskToDo) && count($taskToDo)>0) {
if (is_array($taskToDo) && count($taskToDo) > 0) {
// Load translation files required by the page
$langs->loadLangs(array("eventorganization"));
@ -107,7 +108,7 @@ class InterfaceEventOrganization extends DolibarrTriggers
$result = $task->create($user);
if ($result < 0) {
$this->errors=array_merge($this->errors, $task->errors);
$this->errors = array_merge($this->errors, $task->errors);
$error++;
}
}

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 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
@ -48,7 +49,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 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
@ -46,7 +47,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code

View file

@ -3,6 +3,7 @@
* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.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
@ -53,7 +54,7 @@ class InterfaceNotification extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
@ -167,7 +168,7 @@ class InterfaceNotification extends DolibarrTriggers
}
if ($qualified) {
$ret[] = array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'contexts'=>$obj->contexts, 'label'=>$obj->label, 'description'=>$obj->description, 'elementtype'=>$obj->elementtype);
$ret[] = array('rowid' => $obj->rowid, 'code' => $obj->code, 'contexts' => $obj->contexts, 'label' => $obj->label, 'description' => $obj->description, 'elementtype' => $obj->elementtype);
}
$i++;

View file

@ -49,7 +49,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code

View file

@ -1,6 +1,7 @@
<?php
/*
* Copyright (C) 2018 ptibogxiv <support@ptibogxiv.net>
* 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
@ -52,7 +53,7 @@ class InterfaceStripe extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file
* is inside directory core/triggers
*
@ -157,7 +158,7 @@ class InterfaceStripe extends DolibarrTriggers
$isineec = isInEEC($object);
if ($object->country_code && $isineec) {
//$taxids = $customer->allTaxIds($customer->id);
$customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned));
$customer->createTaxId($customer->id, array('type' => 'eu_vat', 'value' => $vatcleaned));
}
} else {
$taxids = $customer->allTaxIds($customer->id);
@ -228,7 +229,7 @@ class InterfaceStripe extends DolibarrTriggers
$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
if ($card) {
// @phan-suppress-next-line PhanTypeMismatchPropertyProbablyReal
$card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']));
$card->metadata = array('dol_id' => $object->id, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']));
try {
// @phan-suppress-next-line PhanDeprecatedFunction
$card->save();

View file

@ -6,6 +6,7 @@
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@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
@ -50,7 +51,7 @@ class InterfaceContactRoles extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database:

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017-2020 Frédéric France <frederic.france@netlogic.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
@ -46,7 +47,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
}
/**
* Function called when a Dolibarrr business event is done.
* Function called when a Dolibarr business event is done.
* All functions "runTrigger" are triggered if file
* is inside directory core/triggers
*
@ -97,14 +98,14 @@ class InterfaceZapierTriggers extends DolibarrTriggers
}
$logtriggeraction = true;
break;
//case 'USER_NEW_PASSWORD':
//case 'USER_ENABLEDISABLE':
//case 'USER_DELETE':
//case 'USER_LOGIN':
//case 'USER_LOGIN_FAILED':
//case 'USER_LOGOUT':
//case 'USER_NEW_PASSWORD':
//case 'USER_ENABLEDISABLE':
//case 'USER_DELETE':
//case 'USER_LOGIN':
//case 'USER_LOGIN_FAILED':
//case 'USER_LOGOUT':
// Actions
// Actions
case 'ACTION_MODIFY':
//$logtriggeraction = true;
break;
@ -125,18 +126,18 @@ class InterfaceZapierTriggers extends DolibarrTriggers
//$logtriggeraction = true;
break;
// Groups
//case 'USERGROUP_CREATE':
//case 'USERGROUP_MODIFY':
//case 'USERGROUP_DELETE':
// Groups
//case 'USERGROUP_CREATE':
//case 'USERGROUP_MODIFY':
//case 'USERGROUP_DELETE':
// Categories
// case 'CATEGORY_CREATE':
// case 'CATEGORY_MODIFY':
// case 'CATEGORY_DELETE':
// case 'CATEGORY_SET_MULTILANGS':
// Categories
// case 'CATEGORY_CREATE':
// case 'CATEGORY_MODIFY':
// case 'CATEGORY_DELETE':
// case 'CATEGORY_SET_MULTILANGS':
// Companies
// Companies
case 'COMPANY_CREATE':
$resql = $this->db->query($sql);
while ($resql && $obj = $this->db->fetch_array($resql)) {
@ -161,7 +162,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
//$logtriggeraction = true;
break;
// Contacts
// Contacts
case 'CONTACT_CREATE':
$resql = $this->db->query($sql);
while ($resql && $obj = $this->db->fetch_array($resql)) {
@ -186,23 +187,23 @@ class InterfaceZapierTriggers extends DolibarrTriggers
break;
case 'CONTACT_ENABLEDISABLE':
break;
// Products
// case 'PRODUCT_CREATE':
// case 'PRODUCT_MODIFY':
// case 'PRODUCT_DELETE':
// case 'PRODUCT_PRICE_MODIFY':
// case 'PRODUCT_SET_MULTILANGS':
// case 'PRODUCT_DEL_MULTILANGS':
// Products
// case 'PRODUCT_CREATE':
// case 'PRODUCT_MODIFY':
// case 'PRODUCT_DELETE':
// case 'PRODUCT_PRICE_MODIFY':
// case 'PRODUCT_SET_MULTILANGS':
// case 'PRODUCT_DEL_MULTILANGS':
//Stock movement
// case 'STOCK_MOVEMENT':
//Stock movement
// case 'STOCK_MOVEMENT':
//MYECMDIR
// case 'MYECMDIR_DELETE':
// case 'MYECMDIR_CREATE':
// case 'MYECMDIR_MODIFY':
//MYECMDIR
// case 'MYECMDIR_DELETE':
// case 'MYECMDIR_CREATE':
// case 'MYECMDIR_MODIFY':
// Sales orders
// Sales orders
case 'ORDER_CREATE':
$resql = $this->db->query($sql);
while ($resql && $obj = $this->db->fetch_array($resql)) {
@ -226,108 +227,108 @@ class InterfaceZapierTriggers extends DolibarrTriggers
case 'LINEORDER_UPDATE':
case 'LINEORDER_DELETE':
break;
// Supplier orders
// case 'ORDER_SUPPLIER_CREATE':
// case 'ORDER_SUPPLIER_CLONE':
// case 'ORDER_SUPPLIER_VALIDATE':
// case 'ORDER_SUPPLIER_DELETE':
// case 'ORDER_SUPPLIER_APPROVE':
// case 'ORDER_SUPPLIER_REFUSE':
// case 'ORDER_SUPPLIER_CANCEL':
// case 'ORDER_SUPPLIER_SENTBYMAIL':
// case 'ORDER_SUPPLIER_RECEIVE':
// case 'LINEORDER_SUPPLIER_DISPATCH':
// case 'LINEORDER_SUPPLIER_CREATE':
// case 'LINEORDER_SUPPLIER_UPDATE':
// Supplier orders
// case 'ORDER_SUPPLIER_CREATE':
// case 'ORDER_SUPPLIER_CLONE':
// case 'ORDER_SUPPLIER_VALIDATE':
// case 'ORDER_SUPPLIER_DELETE':
// case 'ORDER_SUPPLIER_APPROVE':
// case 'ORDER_SUPPLIER_REFUSE':
// case 'ORDER_SUPPLIER_CANCEL':
// case 'ORDER_SUPPLIER_SENTBYMAIL':
// case 'ORDER_SUPPLIER_RECEIVE':
// case 'LINEORDER_SUPPLIER_DISPATCH':
// case 'LINEORDER_SUPPLIER_CREATE':
// case 'LINEORDER_SUPPLIER_UPDATE':
// Proposals
// case 'PROPAL_CREATE':
// case 'PROPAL_CLONE':
// case 'PROPAL_MODIFY':
// case 'PROPAL_VALIDATE':
// case 'PROPAL_SENTBYMAIL':
// case 'PROPAL_CLOSE_SIGNED':
// case 'PROPAL_CLOSE_REFUSED':
// case 'PROPAL_DELETE':
// case 'LINEPROPAL_INSERT':
// case 'LINEPROPAL_UPDATE':
// case 'LINEPROPAL_DELETE':
// Proposals
// case 'PROPAL_CREATE':
// case 'PROPAL_CLONE':
// case 'PROPAL_MODIFY':
// case 'PROPAL_VALIDATE':
// case 'PROPAL_SENTBYMAIL':
// case 'PROPAL_CLOSE_SIGNED':
// case 'PROPAL_CLOSE_REFUSED':
// case 'PROPAL_DELETE':
// case 'LINEPROPAL_INSERT':
// case 'LINEPROPAL_UPDATE':
// case 'LINEPROPAL_DELETE':
// SupplierProposal
// case 'SUPPLIER_PROPOSAL_CREATE':
// case 'SUPPLIER_PROPOSAL_CLONE':
// case 'SUPPLIER_PROPOSAL_MODIFY':
// case 'SUPPLIER_PROPOSAL_VALIDATE':
// case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
// case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED':
// case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
// case 'SUPPLIER_PROPOSAL_DELETE':
// case 'LINESUPPLIER_PROPOSAL_INSERT':
// case 'LINESUPPLIER_PROPOSAL_UPDATE':
// case 'LINESUPPLIER_PROPOSAL_DELETE':
// SupplierProposal
// case 'SUPPLIER_PROPOSAL_CREATE':
// case 'SUPPLIER_PROPOSAL_CLONE':
// case 'SUPPLIER_PROPOSAL_MODIFY':
// case 'SUPPLIER_PROPOSAL_VALIDATE':
// case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
// case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED':
// case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
// case 'SUPPLIER_PROPOSAL_DELETE':
// case 'LINESUPPLIER_PROPOSAL_INSERT':
// case 'LINESUPPLIER_PROPOSAL_UPDATE':
// case 'LINESUPPLIER_PROPOSAL_DELETE':
// Contracts
// case 'CONTRACT_CREATE':
// case 'CONTRACT_ACTIVATE':
// case 'CONTRACT_CANCEL':
// case 'CONTRACT_CLOSE':
// case 'CONTRACT_DELETE':
// case 'LINECONTRACT_INSERT':
// case 'LINECONTRACT_UPDATE':
// case 'LINECONTRACT_DELETE':
// Contracts
// case 'CONTRACT_CREATE':
// case 'CONTRACT_ACTIVATE':
// case 'CONTRACT_CANCEL':
// case 'CONTRACT_CLOSE':
// case 'CONTRACT_DELETE':
// case 'LINECONTRACT_INSERT':
// case 'LINECONTRACT_UPDATE':
// case 'LINECONTRACT_DELETE':
// Bills
// case 'BILL_CREATE':
// case 'BILL_CLONE':
// case 'BILL_MODIFY':
// case 'BILL_VALIDATE':
// case 'BILL_UNVALIDATE':
// case 'BILL_SENTBYMAIL':
// case 'BILL_CANCEL':
// case 'BILL_DELETE':
// case 'BILL_PAYED':
// case 'LINEBILL_INSERT':
// case 'LINEBILL_UPDATE':
// case 'LINEBILL_DELETE':
// Bills
// case 'BILL_CREATE':
// case 'BILL_CLONE':
// case 'BILL_MODIFY':
// case 'BILL_VALIDATE':
// case 'BILL_UNVALIDATE':
// case 'BILL_SENTBYMAIL':
// case 'BILL_CANCEL':
// case 'BILL_DELETE':
// case 'BILL_PAYED':
// case 'LINEBILL_INSERT':
// case 'LINEBILL_UPDATE':
// case 'LINEBILL_DELETE':
//Supplier Bill
// case 'BILL_SUPPLIER_CREATE':
// case 'BILL_SUPPLIER_UPDATE':
// case 'BILL_SUPPLIER_DELETE':
// case 'BILL_SUPPLIER_PAYED':
// case 'BILL_SUPPLIER_UNPAYED':
// case 'BILL_SUPPLIER_VALIDATE':
// case 'BILL_SUPPLIER_UNVALIDATE':
// case 'LINEBILL_SUPPLIER_CREATE':
// case 'LINEBILL_SUPPLIER_UPDATE':
// case 'LINEBILL_SUPPLIER_DELETE':
//Supplier Bill
// case 'BILL_SUPPLIER_CREATE':
// case 'BILL_SUPPLIER_UPDATE':
// case 'BILL_SUPPLIER_DELETE':
// case 'BILL_SUPPLIER_PAYED':
// case 'BILL_SUPPLIER_UNPAYED':
// case 'BILL_SUPPLIER_VALIDATE':
// case 'BILL_SUPPLIER_UNVALIDATE':
// case 'LINEBILL_SUPPLIER_CREATE':
// case 'LINEBILL_SUPPLIER_UPDATE':
// case 'LINEBILL_SUPPLIER_DELETE':
// Payments
// case 'PAYMENT_CUSTOMER_CREATE':
// case 'PAYMENT_SUPPLIER_CREATE':
// case 'PAYMENT_ADD_TO_BANK':
// case 'PAYMENT_DELETE':
// Payments
// case 'PAYMENT_CUSTOMER_CREATE':
// case 'PAYMENT_SUPPLIER_CREATE':
// case 'PAYMENT_ADD_TO_BANK':
// case 'PAYMENT_DELETE':
// Online
// case 'PAYMENT_PAYBOX_OK':
// case 'PAYMENT_PAYPAL_OK':
// case 'PAYMENT_STRIPE_OK':
// Online
// case 'PAYMENT_PAYBOX_OK':
// case 'PAYMENT_PAYPAL_OK':
// case 'PAYMENT_STRIPE_OK':
// Donation
// case 'DON_CREATE':
// case 'DON_UPDATE':
// case 'DON_DELETE':
// Donation
// case 'DON_CREATE':
// case 'DON_UPDATE':
// case 'DON_DELETE':
// Interventions
// case 'FICHINTER_CREATE':
// case 'FICHINTER_MODIFY':
// case 'FICHINTER_VALIDATE':
// case 'FICHINTER_DELETE':
// case 'LINEFICHINTER_CREATE':
// case 'LINEFICHINTER_UPDATE':
// case 'LINEFICHINTER_DELETE':
// Interventions
// case 'FICHINTER_CREATE':
// case 'FICHINTER_MODIFY':
// case 'FICHINTER_VALIDATE':
// case 'FICHINTER_DELETE':
// case 'LINEFICHINTER_CREATE':
// case 'LINEFICHINTER_UPDATE':
// case 'LINEFICHINTER_DELETE':
// Members
// Members
case 'MEMBER_CREATE':
$resql = $this->db->query($sql);
while ($resql && $obj = $this->db->fetch_array($resql)) {
@ -348,26 +349,26 @@ class InterfaceZapierTriggers extends DolibarrTriggers
}
$logtriggeraction = true;
break;
// case 'MEMBER_VALIDATE':
// case 'MEMBER_SUBSCRIPTION':
// case 'MEMBER_NEW_PASSWORD':
// case 'MEMBER_RESILIATE':
// case 'MEMBER_DELETE':
// case 'MEMBER_VALIDATE':
// case 'MEMBER_SUBSCRIPTION':
// case 'MEMBER_NEW_PASSWORD':
// case 'MEMBER_RESILIATE':
// case 'MEMBER_DELETE':
// Projects
// case 'PROJECT_CREATE':
// case 'PROJECT_MODIFY':
// case 'PROJECT_DELETE':
// Projects
// case 'PROJECT_CREATE':
// case 'PROJECT_MODIFY':
// case 'PROJECT_DELETE':
// Project tasks
// case 'TASK_CREATE':
// case 'TASK_MODIFY':
// case 'TASK_DELETE':
// Project tasks
// case 'TASK_CREATE':
// case 'TASK_MODIFY':
// case 'TASK_DELETE':
// Task time spent
// case 'TASK_TIMESPENT_CREATE':
// case 'TASK_TIMESPENT_MODIFY':
// case 'TASK_TIMESPENT_DELETE':
// Task time spent
// case 'TASK_TIMESPENT_CREATE':
// case 'TASK_TIMESPENT_MODIFY':
// case 'TASK_TIMESPENT_DELETE':
case 'TICKET_CREATE':
$resql = $this->db->query($sql);
// TODO voir comment regrouper les webhooks en un post
@ -379,20 +380,20 @@ class InterfaceZapierTriggers extends DolibarrTriggers
}
$logtriggeraction = true;
break;
// case 'TICKET_MODIFY':
// break;
// case 'TICKET_DELETE':
// break;
// case 'TICKET_MODIFY':
// break;
// case 'TICKET_DELETE':
// break;
// Shipping
// case 'SHIPPING_CREATE':
// case 'SHIPPING_MODIFY':
// case 'SHIPPING_VALIDATE':
// case 'SHIPPING_SENTBYMAIL':
// case 'SHIPPING_BILLED':
// case 'SHIPPING_CLOSED':
// case 'SHIPPING_REOPEN':
// case 'SHIPPING_DELETE':
// Shipping
// case 'SHIPPING_CREATE':
// case 'SHIPPING_MODIFY':
// case 'SHIPPING_VALIDATE':
// case 'SHIPPING_SENTBYMAIL':
// case 'SHIPPING_BILLED':
// case 'SHIPPING_CLOSED':
// case 'SHIPPING_REOPEN':
// case 'SHIPPING_DELETE':
}
if ($logtriggeraction) {
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__." id=".$object->id);

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
print "<!-- BEGIN PHP TEMPLATE delivery/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
echo "<!-- BEGIN PHP TEMPLATE eventorganization/tpl/linkedobjectblock.tpl.php -->\n";

View file

@ -19,7 +19,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -3408,10 +3408,11 @@ class FactureFournisseur extends CommonInvoice
{
global $conf, $langs, $user;
$error = 0;
$this->output = '';
$this->error = '';
$nbMailSend = 0;
$error = 0;
$errorsMsg = array();
$langs->load('bills');
@ -3692,7 +3693,7 @@ class FactureFournisseur extends CommonInvoice
return 0;
} else {
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? implode(', ', $errorsMsg) : $error;
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(empty($errorsMsg) ? $error : implode(', ', $errorsMsg));
dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO);

View file

@ -19,7 +19,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -21,7 +21,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

View file

@ -40,7 +40,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
print "<!-- BEGIN PHP TEMPLATE hrm/core/tpl/objectline_title.tpl.php -->\n";

View file

@ -45,7 +45,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
global $mysoc;

View file

@ -3,7 +3,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}
if (!empty($object->table_element_line)) {

View file

@ -417,7 +417,8 @@ if (!$ok && isset($argv[1])) {
}
dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("--- upgrade: end ".((!$ok && empty($_GET["ignoreerrors"])) || $dirmodule));
dolibarr_install_syslog("--- upgrade: end ".(!$ok && empty($_GET["ignoreerrors"]))." dirmodule=".$dirmodule);
$nonext = (!$ok && empty($_GET["ignoreerrors"])) ? 2 : 0;
if ($dirmodule) {
$nonext = 1;

View file

@ -170,13 +170,13 @@ class PaymentLoan extends CommonObject
$this->fk_loan = (int) $this->fk_loan;
}
if (isset($this->amount_capital)) {
$this->amount_capital = price2num($this->amount_capital ? $this->amount_capital : 0);
$this->amount_capital = (float) price2num($this->amount_capital ? $this->amount_capital : 0);
}
if (isset($this->amount_insurance)) {
$this->amount_insurance = price2num($this->amount_insurance ? $this->amount_insurance : 0);
$this->amount_insurance = (float) price2num($this->amount_insurance ? $this->amount_insurance : 0);
}
if (isset($this->amount_interest)) {
$this->amount_interest = price2num($this->amount_interest ? $this->amount_interest : 0);
$this->amount_interest = (float) price2num($this->amount_interest ? $this->amount_interest : 0);
}
if (isset($this->fk_typepayment)) {
$this->fk_typepayment = (int) $this->fk_typepayment;
@ -201,7 +201,7 @@ class PaymentLoan extends CommonObject
}
$totalamount = $this->amount_capital + $this->amount_insurance + $this->amount_interest;
$totalamount = price2num($totalamount);
$totalamount = (float) price2num($totalamount);
// Check parameters
if ($totalamount == 0) {
@ -332,13 +332,13 @@ class PaymentLoan extends CommonObject
$this->fk_loan = (int) $this->fk_loan;
}
if (isset($this->amount_capital)) {
$this->amount_capital = trim($this->amount_capital);
$this->amount_capital = (float) $this->amount_capital;
}
if (isset($this->amount_insurance)) {
$this->amount_insurance = trim($this->amount_insurance);
$this->amount_insurance = (float) $this->amount_insurance;
}
if (isset($this->amount_interest)) {
$this->amount_interest = trim($this->amount_interest);
$this->amount_interest = (float) $this->amount_interest;
}
if (isset($this->fk_typepayment)) {
$this->fk_typepayment = (int) $this->fk_typepayment;

View file

@ -176,6 +176,11 @@ $myTmpObjects = array();
// TODO Scan list of objects to fill this array
$myTmpObjects['myobject'] = array('label'=>'MyObject', 'includerefgeneration'=>0, 'includedocgeneration'=>0, 'class'=>'MyObject');
$tmpobjectkey = GETPOST('object', 'aZ09');
if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
accessforbidden('Bad value for object. Hack attempt ?');
}
/*
* Actions
@ -204,49 +209,45 @@ if ($action == 'updateMask') {
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
} elseif ($action == 'specimen' && $tmpobjectkey) {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object', 'aZ09');
if (in_array($tmpobjectkey, $myTmpObjects)) {
$className = $myTmpObjects[$tmpobjectkey];
$tmpobject = new $className($db);
$tmpobject->initAsSpecimen();
$className = $myTmpObjects[$tmpobjectkey]['class'];
$tmpobject = new $className($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$className = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$className = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
// Search template files
$file = '';
$className = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$className = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
}
if ($filefound) {
require_once $file;
if ($filefound) {
require_once $file;
$module = new $className($db);
$module = new $className($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
@ -257,7 +258,6 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
@ -267,7 +267,6 @@ if ($action == 'updateMask') {
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
@ -283,7 +282,6 @@ if ($action == 'updateMask') {
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);

View file

@ -18,7 +18,7 @@
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
exit(1);
}

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