Debug v24
This commit is contained in:
parent
d9c59b742c
commit
3855732a0e
9 changed files with 40 additions and 29 deletions
|
|
@ -6968,6 +6968,13 @@ abstract class CommonObject
|
|||
$attributeUnique = $extrafields->attributes[$this->table_element]['unique'][$attributeKey];
|
||||
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
|
||||
$attributeEmptyOnClone = $extrafields->attributes[$this->table_element]['emptyonclone'][$attributeKey];
|
||||
/*
|
||||
$attributeEnabled = $extrafields->attributes[$this->table_element]['enabled'][$attributeKey];
|
||||
$enabled = 0;
|
||||
if (!empty($extrafields->attributes[$this->table_element]['enabled'][$key])) {
|
||||
$enabled = (int) dol_eval((string) $extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2');
|
||||
}
|
||||
*/
|
||||
|
||||
// If we clone, we have to clean unique extrafields to prevent duplicates.
|
||||
// If we clone, we have to clean extrafields having "empty on clone" option on.
|
||||
|
|
@ -6985,7 +6992,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
// Similar code than into insertExtraFields
|
||||
if ($attributeRequired) {
|
||||
if ($attributeRequired) { // If attribute is "Mandatory", then it is also in database as "Not null", so we must check even if attribute is not 'enabled'.
|
||||
$v = $this->array_options[$key];
|
||||
if (ExtraFields::isEmptyValue($v, $attributeType)) {
|
||||
$langs->load("errors");
|
||||
|
|
@ -7441,15 +7448,16 @@ abstract class CommonObject
|
|||
$value = $this->array_options["options_".$key];
|
||||
|
||||
$attributeKey = $key;
|
||||
$attributeType = $extrafields->attributes[$this->table_element]['type'][$key];
|
||||
$attributeLabel = $extrafields->attributes[$this->table_element]['label'][$key];
|
||||
$attributeParam = $extrafields->attributes[$this->table_element]['param'][$key];
|
||||
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key];
|
||||
$attributeType = $extrafields->attributes[$this->table_element]['type'][$attributeKey];
|
||||
$attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey];
|
||||
$attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey];
|
||||
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
|
||||
$attributeUnique = $extrafields->attributes[$this->table_element]['unique'][$attributeKey];
|
||||
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$key];
|
||||
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
|
||||
//$attributeEnabled = $extrafields->attributes[$this->table_element]['enabled'][$attributeKey];
|
||||
|
||||
// Similar code than into insertExtraFields
|
||||
if ($attributeRequired) {
|
||||
if ($attributeRequired) { // If attribute is "Mandatory", then it is also in database as "Not null", so we must check even if attribute is not 'enabled'.
|
||||
$mandatorypb = false;
|
||||
if ($attributeType == 'link' && $this->array_options["options_".$key] == '-1') {
|
||||
$mandatorypb = true;
|
||||
|
|
|
|||
|
|
@ -819,6 +819,7 @@ class ExtraFields
|
|||
$result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip, $personal_data);
|
||||
}
|
||||
if ($result > 0) {
|
||||
// Add or remove the unique index
|
||||
$sql = '';
|
||||
if ($unique) {
|
||||
dol_syslog(get_class($this).'::update_unique', LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -1058,6 +1058,7 @@ class DoliDBMysqli extends DoliDB
|
|||
}
|
||||
}
|
||||
|
||||
//print $sql;exit;
|
||||
dol_syslog(get_class($this)."::DDLUpdateField ".$sql, LOG_DEBUG);
|
||||
if (!$this->query($sql)) {
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -268,11 +268,11 @@ if (!getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) {
|
|||
echo $form->textwithpicto($langs->trans("AIPromptExtrafield"), $texthelp, 1, 'help', 'valignmiddle', 0, 3, 'abc');?></td>
|
||||
<td class="valeur"><textarea name="ai_prompt" id="ai_prompt" class="quatrevingtpercent" rows="<?php echo ROWS_4 ?>"><?php echo(GETPOSTISSET('ai_prompt') ? GETPOST('ai_prompt', 'restricthtml') : ''); ?></textarea></td></tr>
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" class="minwidth200" value="<?php echo(GETPOST('default_value', 'alpha') ? GETPOST('default_value', 'alpha') : ''); ?>" spellcheck="false"></td></tr>
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' <span class="opacitymedium small">('.$langs->trans("Database").')</span>'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" class="minwidth200" value="<?php echo(GETPOST('default_value', 'alpha') ? GETPOST('default_value', 'alpha') : ''); ?>" spellcheck="false"></td></tr>
|
||||
<!-- Unique -->
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo(GETPOST('unique', 'alpha') ? ' checked' : ''); ?>></td></tr>
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique").' <span class="opacitymedium small">('.$langs->trans("Database").')</span>'; ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo(GETPOST('unique', 'alpha') ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Required -->
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Mandatory"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo(GETPOST('required', 'alpha') ? ' checked' : ''); ?>></td></tr>
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Mandatory").' <span class="opacitymedium small">('.$langs->trans("Database").')</span>'; ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo(GETPOST('required', 'alpha') ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Always editable -->
|
||||
<tr class="extra_alwayseditable"><td><?php echo $form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo((GETPOST('alwayseditable', 'alpha') || !GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Empty on clone -->
|
||||
|
|
|
|||
|
|
@ -345,13 +345,13 @@ if (!getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) {
|
|||
<td class="valeur"><textarea name="ai_prompt" id="ai_prompt" class="quatrevingtpercent" rows="<?php echo ROWS_4 ?>"><?php echo($aiprompt); ?></textarea></td></tr>
|
||||
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" class="minwidth200" value="<?php echo dol_escape_htmltag($default); ?>" spellcheck="false"></td></tr>
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' <span class="opacitymedium small">('.$langs->trans("Database").')</span>'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" class="minwidth200" value="<?php echo dol_escape_htmltag($default); ?>" spellcheck="false"></td></tr>
|
||||
|
||||
<!-- Unique -->
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo($unique ? ' checked' : ''); ?>></td></tr>
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique").' <span class="opacitymedium small">('.$langs->trans("Database").')</span>'; ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo($unique ? ' checked' : ''); ?>></td></tr>
|
||||
|
||||
<!-- Required -->
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Mandatory"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo($required ? ' checked' : ''); ?>></td></tr>
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Mandatory").' <span class="opacitymedium small">('.$langs->trans("Database").')</span>'; ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo($required ? ' checked' : ''); ?>></td></tr>
|
||||
|
||||
<!-- Always editable -->
|
||||
<tr class="extra_alwayseditable"><td><?php echo $form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo($alwayseditable ? ' checked' : ''); ?>></td></tr>
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ abstract class AbstractRestAPITest extends CommonClassTest
|
|||
|
||||
$this->assertNotNull($object, "$test Parsing of JSON result must not be null");
|
||||
$this->assertNotEquals(500, (empty($object['error']['code']) ? 0 : $object['error']['code']), "$test Error".(empty($object['error']['message']) ? '' : ' '.$object['error']['message']));
|
||||
$this->assertEquals('200', $object['success']['code']);
|
||||
$this->assertEquals('200', $object['success']['code'] ?? 0, "API call for setup failed");
|
||||
|
||||
$this->api_key = isset($object['success']['token']) ? $object['success']['token'] : null;
|
||||
|
||||
|
|
|
|||
|
|
@ -137,18 +137,6 @@ class AllTests
|
|||
require_once dirname(__FILE__).'/XCalLibTest.php';
|
||||
$suite->addTestSuite('XCalLibTest');
|
||||
|
||||
// Rules into source files content
|
||||
require_once dirname(__FILE__).'/RepositoryTest.php';
|
||||
$suite->addTestSuite('RepositoryTest');
|
||||
require_once dirname(__FILE__).'/LangTest.php';
|
||||
$suite->addTestSuite('LangTest');
|
||||
require_once dirname(__FILE__).'/CodingSqlTest.php';
|
||||
$suite->addTestSuite('CodingSqlTest');
|
||||
require_once dirname(__FILE__).'/CodingPhpTest.php';
|
||||
$suite->addTestSuite('CodingPhpTest');
|
||||
require_once dirname(__FILE__).'/DoliDBTest.php';
|
||||
$suite->addTestSuite('DoliDBTest');
|
||||
|
||||
require_once dirname(__FILE__).'/SecurityTest.php';
|
||||
$suite->addTestSuite('SecurityTest');
|
||||
require_once dirname(__FILE__).'/SecurityGETPOSTTest.php';
|
||||
|
|
@ -330,11 +318,24 @@ class AllTests
|
|||
require_once dirname(__FILE__).'/WebsiteTest.php';
|
||||
$suite->addTestSuite('WebsiteTest');
|
||||
|
||||
// At end because it's the longer
|
||||
// --- At end because it's the longer
|
||||
|
||||
// Also enabling and disabling modules is changing the context and global variables that changes behaviour of previous tests
|
||||
require_once dirname(__FILE__).'/ModulesTest.php';
|
||||
$suite->addTestSuite('ModulesTest');
|
||||
|
||||
// Rules into source files content
|
||||
require_once dirname(__FILE__).'/RepositoryTest.php';
|
||||
$suite->addTestSuite('RepositoryTest');
|
||||
require_once dirname(__FILE__).'/LangTest.php';
|
||||
$suite->addTestSuite('LangTest');
|
||||
require_once dirname(__FILE__).'/CodingSqlTest.php';
|
||||
$suite->addTestSuite('CodingSqlTest');
|
||||
require_once dirname(__FILE__).'/CodingPhpTest.php';
|
||||
$suite->addTestSuite('CodingPhpTest');
|
||||
require_once dirname(__FILE__).'/DoliDBTest.php';
|
||||
$suite->addTestSuite('DoliDBTest');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ abstract class CommonClassTest extends TestCase
|
|||
'dav' => 'Dav',
|
||||
'debugbar' => 'DebugBar',
|
||||
'shipping' => 'Expedition',
|
||||
'deplacement' => 'Deplacement', // TODO Remove module
|
||||
'deplacement' => null,
|
||||
"documentgeneration" => 'DocumentGeneration', // TODO: fill in proper name
|
||||
'don' => 'Don',
|
||||
'dynamicprices' => 'DynamicPrices',
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class SocieteTest extends CommonClassTest
|
|||
|
||||
$result = $localobject->update($localobject->id, $user);
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
$this->assertLessThan($result, 0, __METHOD__." id=".$localobject->id." result=".$result);
|
||||
|
||||
$result = $localobject->update_note($localobject->note_private, '_private');
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
|
|
|
|||
Loading…
Reference in a new issue