Module builder

This commit is contained in:
Laurent Destailleur 2017-09-29 15:19:49 +02:00
parent abc86d72f6
commit d2d77d4625
3 changed files with 40 additions and 10 deletions

View File

@ -79,7 +79,7 @@ $formfile->form_attach_new_file(
);
$disablemove=1;
if ($modulepart == 'produit') $disablemove=0;
if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product
// List of document
$formfile->list_of_documents(

View File

@ -478,13 +478,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '"';
print '>'.$langs->trans($val['label']).'</td>';
print '<td>';
print $object->$key;
print dol_escape_htmltag($object->$key, 1, 1);
print '</td>';
print '</tr>';
}
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
//if ($key == 'targetsrcfile3') break; // key used for break on second column
}
print '</table>';
print '</div>';
@ -493,7 +492,30 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// ...
$alreadyoutput = 1;
foreach($object->fields as $key => $val)
{
if ($alreadyoutput)
{
//if ($key == 'targetsrcfile3') $alreadyoutput = 0; // key used for break on second column
continue;
}
if (in_array($key, array('rowid', 'ref', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key', 'status'))) continue;
print '<tr><td';
print ' class="titlefield';
if ($val['notnull'] > 0) print ' fieldrequired';
print '"';
print '>'.$langs->trans($val['label']).'</td>';
print '<td>';
print dol_escape_htmltag($object->$key, 1, 1);
print '</td>';
print '</tr>';
}
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';

View File

@ -79,7 +79,9 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject');
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity] . "/" . $object->id;
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->ref);
@ -167,10 +169,16 @@ if ($object->id)
dol_fiche_end();
$modulepart = 'societe';
$permission = $user->rights->societe->creer;
$permtoedit = $user->rights->societe->creer;
$modulepart = 'mymodule';
//$permission = $user->rights->mymodule->create;
$permission = 1;
//$permtoedit = $user->rights->mymodule->create;
$permtoedit = 1;
$param = '&id=' . $object->id;
//$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->id).'/';
$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else