Enhance modulebuilder

This commit is contained in:
Laurent Destailleur
2024-02-12 06:08:22 +01:00
committed by Laurent Destailleur
parent f1c90dcd6b
commit 0920d6e08f
6 changed files with 15 additions and 14 deletions

View File

@@ -148,7 +148,8 @@ class ExtraFields
$result = 0;
if ($type == 'separate') {
if ($type == 'separator' || $type == 'separate') {
$type = 'separate';
$unique = 0;
$required = 0;
} // Force unique and not required if this is a separator field to avoid troubles.

View File

@@ -433,8 +433,7 @@ ModifyValueExtrafields = Modify value of an extrafield
OrProductsWithCategories=Or products with tags/categories
WarningTransferBatchStockMouvToGlobal = If you want to deserialize this product, all its serialized stock will be transformed into global stock
WarningConvertFromBatchToSerial=If you currently have a quantity higher or equal to 2 for the product, switching to this choice means you will still have a product with different objects of the same batch (while you want a unique serial number). The duplicate will remain until an inventory or a manual stock movement to fix this is done.
AllowStockMovementVariantParent=Allow stock movements on the variant parent
AllowStockMovementVariantParent=Also records stock movements on parent products of variant products
AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtual product, so no stock is managed for it. By enabling this option, a stock will be managed for parent products and each time a stock quantity is modified for a variant product, the same quantity will be modified for the parent product. You should not need this option, except if you are using variant to manage the same product than parent (but with different descriptions, prices...)
ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?<br>The quantities currently set in the inventory will be reset.

View File

@@ -452,11 +452,12 @@ class modMyModule extends DolibarrModules
// Create extrafields during init
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
//$extrafields = new ExtraFields($this->db);
//$result1=$extrafields->addExtraField('mymodule_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result2=$extrafields->addExtraField('mymodule_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result3=$extrafields->addExtraField('mymodule_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result4=$extrafields->addExtraField('mymodule_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result5=$extrafields->addExtraField('mymodule_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result0=$extrafields->addExtraField('mymodule_separator1', "Separator 1", 'separator', 1, 0, 'thirdparty', 0, 0, '', array('options'=>array(1=>1)), 1, '', 1, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result1=$extrafields->addExtraField('mymodule_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', -1, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result2=$extrafields->addExtraField('mymodule_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', -1, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result3=$extrafields->addExtraField('mymodule_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', -1, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result4=$extrafields->addExtraField('mymodule_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', -1, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
//$result5=$extrafields->addExtraField('mymodule_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', -1, 0, '', '', 'mymodule@mymodule', 'isModEnabled("mymodule")');
// Permissions
$this->remove($options);

View File

@@ -854,7 +854,7 @@ textarea.centpercent {
word-wrap: break-word;
}
.wordbreakimp {
word-break: break-word;
word-break: break-word !important;
}
.wordbreak {
word-break: break-word; /* cut fist between word, inside word if not possible */
@@ -862,7 +862,7 @@ textarea.centpercent {
.wordbreakall {
word-break: break-all;
}
td.wordbreak img {
td.wordbreak img, td.wordbreakimp img {
max-width: 100%;
}
.bold {

View File

@@ -1107,7 +1107,7 @@ textarea.centpercent {
word-wrap: break-word;
}
.wordbreakimp {
word-break: break-word;
word-break: break-word !important;
}
.wordbreak {
word-break: break-word; /* cut fist between word, inside word if not possible */
@@ -1115,7 +1115,7 @@ textarea.centpercent {
.wordbreakall {
word-break: break-all;
}
td.wordbreak img {
td.wordbreak img, td.wordbreakimp img {
max-width: 100%;
}
.bold {

View File

@@ -88,7 +88,7 @@ if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
}
print '<td class="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans('AllowStockMovementVariantParent').'</td><td>';
print '<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans('AllowStockMovementVariantParent'), $langs->trans('AllowStockMovementVariantParentHelp')).'</td><td>';
print $form->selectyesno("VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT", getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT'), 1).'</td></tr>';
print '</table>';